Fetching contributors…
Cannot retrieve contributors at this time
39 lines (28 sloc) 1.07 KB
# This template defines the things we want to add to the makefile for each app.
define APP_template
APP_RELS := $$(patsubst %.c,%.rel, $$(wildcard apps/$(1)/*.c)) $$(patsubst %.s,%.rel, $$(wildcard apps/$(1)/*.s))
-include apps/$(1)/
APP_LIBS := $$(foreach lib, $$(APP_LIBS), libraries/lib/$$(lib))
RELs += $$(APP_RELS)
HEXs += apps/$(1)/$(1).hex
apps/$(1)/$(1).hex : $$(APP_RELS) $$(APP_LIBS)
$$(V)mv -f $$(@:%.hex=%.ihx) $$@
.PHONY : $(1)
$(1) : apps/$(1)/$(1).wxl
.PHONY : load_$(1)
load_$(1) : apps/$(1)/$(1).wxl
$$(WIXELCMD) write $$< $$(S) -a
.PHONY : open_$(1)
open_$(1) : apps/$(1)/$(1).wxl
# Auto detect the apps, and store the list of app names in the APPs variable.
APPs := $(foreach app, $(wildcard apps/*),$(notdir $(app)))
# Add information about each app to the Makefile.
$(foreach app, $(APPs), $(eval $(call APP_template,$(app))))
# Make a phony target called "apps" which builds all the apps.
# You can type "make apps" to build all the apps.
.PHONY : apps
apps: $(APPs)