improve application Makfile

This commit is contained in:
Stefan `Sec` Zehl 2011-08-01 01:08:05 +02:00
parent 1ccda41467
commit 621bca40b3
3 changed files with 9 additions and 11 deletions

View File

@ -33,6 +33,7 @@ endif
WRAP=wrapper WRAP=wrapper
LIBNAME=app LIBNAME=app
########################################################################## ##########################################################################
# GNU GCC compiler flags # GNU GCC compiler flags
########################################################################## ##########################################################################
@ -66,21 +67,21 @@ $(LOBJ):
OBJS += $(LOBJ) OBJS += $(LOBJ)
endif endif
ifeq "$(APP)" "tester" ifeq "$(wildcard $(APP))" "$(APP)"
ifndef TYPE ifndef TYPE
TYPE=$(APP) TYPE=$(APP)
endif endif
TSRCS = $(wildcard $(TYPE)/*.c) TSRCS = $(wildcard $(TYPE)/*.c)
TOBJS = $(foreach mod,$(TSRCS),$(subst .c,.o,$(mod))) TOBJS = $(foreach mod,$(TSRCS),$(subst .c,.o,$(mod)))
TWRAP=tester.gen TWRAP=$(APP).gen
.PHONY: $(TWRAP) .PHONY: $(TWRAP)
$(APP).o: $(TWRAP) $(APP).o: $(TWRAP)
$(TWRAP): $(TWRAP):
./mktester $(TSRCS) > $@ ./mkfirmware $(APP) $(TSRCS) > $@
OBJS += $(TOBJS) OBJS += $(TOBJS)
endif endif
@ -93,7 +94,7 @@ $(LIBFILE): $(OBJS) $(WRAPOBJ)
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
clean: clean:
rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o */*.o rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o */*.o *.gen
%.c: %.c:
@echo @echo

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
APP=$1
shift
for f in $* ; do for f in $* ; do
grep -h '^void ' $f|sed 's/^void //;s/(.*//'|while read a ; do grep -h '^void ' $f|sed 's/^void //;s/(.*//'|while read a ; do
echo "void $a(void);" echo "void $a(void);"
@ -58,7 +61,7 @@ done
echo "NULL" echo "NULL"
echo "};" echo "};"
echo "inline void generated_tick(void){" echo "inline void tick_${APP}(void){"
for f in $* ; do for f in $* ; do
grep -h '^void tick_' $f|sed 's/^void //;s/(.*//'|while read a ; do grep -h '^void tick_' $f|sed 's/^void //;s/(.*//'|while read a ; do
echo "$a();" echo "$a();"

View File

@ -16,9 +16,3 @@ void main_tester(void) {
handleMenu(&mainmenu); handleMenu(&mainmenu);
gotoISP(); gotoISP();
}; };
void tick_tester(void){
generated_tick();
};