Fix dependecies and building for APP=loadable

This commit is contained in:
Stefan `Sec` Zehl 2011-07-19 10:14:54 +02:00
parent 6a8da54274
commit 18dc47fa2b
2 changed files with 21 additions and 9 deletions

View File

@ -21,13 +21,6 @@ endif
OBJS += $(ME_OBJ).o
endif
ifeq "$(APP)" "loadable"
ifndef LAPP
LAPP=blinktest
endif
OBJS += ../loadable/$(LAPP).o
endif
WRAP=wrapper
LIBNAME=app
@ -49,6 +42,22 @@ LIBFILE=lib$(LIBNAME).a
all: $(LIBFILE)
ifeq "$(APP)" "loadable"
ifndef LAPP
LAPP=blinktest
endif
LSRC=../loadable/$(LAPP).c
LOBJ=loadable_$(LAPP).o
.PHONY: $(LOBJ)
$(LOBJ):
$(CC) $(CFLAGS) -o $@ $(LSRC)
$(RM) $(LIBFILE)
OBJS += $(LOBJ)
endif
$(LIBFILE): $(OBJS) $(WRAPOBJ)
$(AR) rcs $@ $(OBJS) $(WRAPOBJ)

View File

@ -2,7 +2,7 @@
for a in $* ; do
case $a in
*/*) continue;;
loadable_*) continue;;
esac
base=${a%.o}
echo "void main_$base(void);"
@ -14,7 +14,7 @@ echo "void wrapper(void){"
for a in $* ; do
case $a in
*/*) continue;;
loadable_*) continue;;
esac
base=${a%.o}
echo "main_$base();"
@ -25,6 +25,9 @@ echo "}"
echo "void tick_wrapper(void){"
for a in $* ; do
case $a in
loadable_*) continue;;
esac
base=${a%.o}
grep -q \ tick_$base ${base}.c && echo "tick_$base();"
done