Skip to content

Instantly share code, notes, and snippets.

@lucasdemarchi
Created December 2, 2015 19:57
Show Gist options
  • Save lucasdemarchi/691885632c4c4c6a7e55 to your computer and use it in GitHub Desktop.
Save lucasdemarchi/691885632c4c4c6a7e55 to your computer and use it in GitHub Desktop.
diff --git a/Makefile.waf b/Makefile.waf
index f16c71a..d7db696 100644
--- a/Makefile.waf
+++ b/Makefile.waf
@@ -1,25 +1,24 @@
-ROOT = $(dir $(lastword $(MAKEFILE_LIST)))
+ROOT = $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
-WAF_BINARY = $(realpath $(ROOT)/modules/waf/waf-light)
+WAF_BINARY = $(ROOT)/modules/waf/waf-light
WAF = $(WAF_BINARY) $(WAF_FLAGS)
+PHONY =
-EXPLICIT_COMMANDS = check clean list_boards
+WAF_COMMANDS = check clean list_boards
+PHONY += $(WAF_COMMANDS)
VEHICLES = copter plane rover
-
-copter_DIR = ArduCopter
-plane_DIR = ArduPlane
-rover_DIR = APMrover2
+PHONY += $(VEHICLES)
ifneq ($(BUILD_VEHICLE),)
-all: $(BUILD_VEHICLE)
+all: $(BUILD_VEHICLE) $(WAF_BINARY)
else
all: $(WAF_BINARY)
@$(WAF) build
endif
$(WAF_BINARY):
- @git submodule init && git submodule update
+ @$(ROOT)/mk/check_modules.sh
waf-%: $(WAF_BINARY)
@$(WAF) $*
@@ -27,15 +26,14 @@ waf-%: $(WAF_BINARY)
%-configure: $(WAF_BINARY)
@$(WAF) configure --board $*
-$(EXPLICIT_COMMANDS): $(WAF_BINARY)
+$(WAF_COMMANDS): $(WAF_BINARY)
@$(WAF) $@
$(VEHICLES): $(WAF_BINARY)
@echo Build for vehicle $@
@cd $(ROOT)/$($@_DIR) && $(WAF) build
-.DEFAULT: %-configure
- @$(WAF) configure --board $@ build
+PHONY += help
help:
@echo "Ardupilot Building"
@@ -88,3 +86,5 @@ help:
# Don't run in parallel, let waf take care of that.
.NOTPARALLEL:
+
+.PHONY: $(PHONY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment