software: more flexible compilation target
This commit is contained in:
parent
ee8ef23f2f
commit
20b137fce9
|
@ -24,6 +24,9 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
|
||||||
-lbase -lcompiler_rt
|
-lbase -lcompiler_rt
|
||||||
chmod -x $@
|
chmod -x $@
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(compile-dep)
|
||||||
|
|
||||||
libs:
|
libs:
|
||||||
make -C $(M2DIR)/software/libbase
|
make -C $(M2DIR)/software/libbase
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,12 @@ LDFLAGS = -nostdlib -nodefaultlibs
|
||||||
# compile and generate dependencies, based on
|
# compile and generate dependencies, based on
|
||||||
# http://scottmcpeak.com/autodepend/autodepend.html
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
||||||
|
|
||||||
%.o: $(SRCDIR)%.c
|
define compile-dep =
|
||||||
$(CC) -c $(CFLAGS) $(SRCDIR)$*.c -o $*.o
|
$(CC) -c $(CFLAGS) $< -o $*.o
|
||||||
@$(CC_normal) -MM $(CFLAGS) $(SRCDIR)$*.c > $*.d
|
@$(CC_normal) -MM $(CFLAGS) $< > $*.d
|
||||||
@mv -f $*.d $*.d.tmp
|
@mv -f $*.d $*.d.tmp
|
||||||
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
|
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
|
||||||
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
|
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
|
||||||
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
|
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
|
||||||
@rm -f $*.d.tmp
|
@rm -f $*.d.tmp
|
||||||
|
endef
|
||||||
|
|
|
@ -12,6 +12,9 @@ libbase.a: $(OBJECTS)
|
||||||
$(AR) clr libbase.a $(OBJECTS)
|
$(AR) clr libbase.a $(OBJECTS)
|
||||||
$(RANLIB) libbase.a
|
$(RANLIB) libbase.a
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(compile-dep)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
Loading…
Reference in New Issue