2011-05-21 10:05:48 +00:00
|
|
|
##########################################################################
|
|
|
|
# User configuration and firmware specific object files
|
|
|
|
##########################################################################
|
|
|
|
|
2011-07-26 22:28:08 +00:00
|
|
|
OBJS =
|
2011-07-26 23:02:26 +00:00
|
|
|
|
|
|
|
ifeq "$(APP)" "initial"
|
|
|
|
NODEFAULT = y
|
|
|
|
endif
|
|
|
|
|
2011-07-26 22:28:08 +00:00
|
|
|
ifndef NODEFAULT
|
|
|
|
OBJS += default.o
|
|
|
|
endif
|
|
|
|
|
2011-06-20 21:33:42 +00:00
|
|
|
OBJS += $(foreach mod,$(APP),$(mod).o)
|
2011-05-21 10:05:48 +00:00
|
|
|
|
2011-06-20 21:33:42 +00:00
|
|
|
SRCS = $(foreach mod,$(APP),$(mod).c)
|
2011-06-15 21:40:46 +00:00
|
|
|
|
2011-06-20 21:33:42 +00:00
|
|
|
ifndef APP
|
2011-05-21 10:05:48 +00:00
|
|
|
ME_OBJ=$(USERNAME)
|
|
|
|
|
2011-05-21 23:02:47 +00:00
|
|
|
ifeq "$(ME_OBJ)" ""
|
|
|
|
ME_OBJ=$(USER)
|
|
|
|
endif
|
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
ifeq "$(ME_OBJ)" ""
|
|
|
|
ME_OBJ=nouser
|
|
|
|
endif
|
2011-05-21 23:02:47 +00:00
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
OBJS += $(ME_OBJ).o
|
|
|
|
endif
|
|
|
|
|
|
|
|
WRAP=wrapper
|
2011-06-20 21:33:42 +00:00
|
|
|
LIBNAME=app
|
2011-05-21 10:05:48 +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
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Compiler settings, parameters and flags
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
all: $(LIBFILE)
|
|
|
|
|
2011-07-19 08:14:54 +00:00
|
|
|
ifeq "$(APP)" "loadable"
|
|
|
|
ifndef LAPP
|
|
|
|
LAPP=blinktest
|
|
|
|
endif
|
|
|
|
LSRC=../loadable/$(LAPP).c
|
|
|
|
LOBJ=loadable_$(LAPP).o
|
|
|
|
|
|
|
|
.PHONY: $(LOBJ)
|
|
|
|
|
|
|
|
$(LOBJ):
|
|
|
|
$(CC) $(CFLAGS) -o $@ $(LSRC)
|
|
|
|
|
|
|
|
OBJS += $(LOBJ)
|
|
|
|
endif
|
|
|
|
|
2011-07-24 00:47:07 +00:00
|
|
|
ifeq "$(APP)" "tester"
|
|
|
|
TSRCS = $(wildcard $(APP)/*.c)
|
|
|
|
TOBJS = $(foreach mod,$(TSRCS),$(subst .c,.o,$(mod)))
|
|
|
|
|
|
|
|
TWRAP=tester.gen
|
|
|
|
|
|
|
|
.PHONY: $(TWRAP)
|
|
|
|
|
|
|
|
$(APP).o: $(TWRAP)
|
|
|
|
|
|
|
|
$(TWRAP):
|
|
|
|
./mktester $(TSRCS) > $@
|
|
|
|
|
|
|
|
OBJS += $(TOBJS)
|
|
|
|
endif
|
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
$(LIBFILE): $(OBJS) $(WRAPOBJ)
|
2011-07-26 22:28:08 +00:00
|
|
|
$(RM) -f $@
|
2011-05-21 10:05:48 +00:00
|
|
|
$(AR) rcs $@ $(OBJS) $(WRAPOBJ)
|
|
|
|
|
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
2011-07-25 23:18:31 +00:00
|
|
|
rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o tester/*.o
|
2011-05-21 10:05:48 +00:00
|
|
|
|
2011-05-21 16:54:02 +00:00
|
|
|
%.c:
|
|
|
|
@echo
|
|
|
|
@echo "You need to create $@ first"
|
2011-06-20 21:33:42 +00:00
|
|
|
@echo "It should contain a single function void main_filename(void)"
|
2011-05-21 16:54:02 +00:00
|
|
|
@echo
|
|
|
|
@exit 1
|
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
$(WRAPSRC):
|
|
|
|
./mkwrapper $(OBJS) > $@
|
|
|
|
|
2011-06-15 21:40:46 +00:00
|
|
|
.PHONY: $(LIBFILE) $(WRAPSRC) $(SRCS)
|
2011-05-21 16:54:02 +00:00
|
|
|
|
|
|
|
.SUFFIXES:
|