crashtest-r0ket/firmware/applications/Makefile

110 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

##########################################################################
# User configuration and firmware specific object files
##########################################################################
OBJS =
2011-12-19 20:20:58 +00:00
ifndef APP
APP=final
endif
ifeq "$(APP)" "initial"
NODEFAULT = y
endif
ifeq "$(APP)" "tester"
DEBUG = -d
endif
ifndef NODEFAULT
OBJS += default.o
endif
OBJS += $(foreach mod,$(APP),$(mod).o)
SRCS = $(foreach mod,$(APP),$(mod).c)
WRAP=wrapper
LIBNAME=app
2011-07-31 23:08:05 +00:00
##########################################################################
# GNU GCC compiler flags
##########################################################################
ROOT_PATH?= ..
INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I.
include $(ROOT_PATH)/Makefile.inc
WRAPOBJ=$(WRAP).o
WRAPSRC=$(WRAP).c
LIBFILE=lib$(LIBNAME).a
2011-08-05 08:26:24 +00:00
ifeq "$(FINAL)" "y"
CFLAGS+=-DFINAL
endif
##########################################################################
# Compiler settings, parameters and flags
##########################################################################
all: $(LIBFILE)
2011-08-03 22:12:11 +00:00
ifeq "$(APP)" "l0dable"
ifndef LAPP
LAPP=blinktest
endif
LSRC=../l0dable/$(LAPP).c
LOBJ=l0dable_$(LAPP).o
.PHONY: $(LOBJ)
$(LOBJ):
$(CC) $(CFLAGS) -o $@ $(LSRC)
OBJS += $(LOBJ)
endif
2011-07-31 23:08:05 +00:00
ifeq "$(wildcard $(APP))" "$(APP)"
ifndef TYPE
TYPE=$(APP)
endif
TSRCS = $(foreach type,$(TYPE),$(wildcard $(type)/*.c))
TOBJS = $(foreach mod,$(TSRCS),$(subst .c,.o,$(mod)))
2011-07-31 23:08:05 +00:00
TWRAP=$(APP).gen
.PHONY: $(TWRAP)
$(APP).o: $(TWRAP)
$(TWRAP):
./mkfirmware.pl $(DEBUG) $(APP) $(TSRCS) > $@
OBJS += $(TOBJS)
endif
$(LIBFILE): $(OBJS) $(WRAPOBJ)
$(RM) -f $@
$(AR) rcs $@ $(OBJS) $(WRAPOBJ)
%.o : %.c
$(CC) $(CFLAGS) -o $@ $<
clean:
2011-07-31 23:08:05 +00:00
rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o */*.o *.gen
%.c:
@echo
@echo "You need to create $@ first"
@echo "It should contain a single function void main_filename(void)"
@echo
@exit 1
$(WRAPSRC):
./mkwrapper $(OBJS) > $@
.PHONY: $(LIBFILE) $(WRAPSRC) $(SRCS)
.SUFFIXES: