software/makefiles: remove dependency system, make all always a phony target

This commit is contained in:
Sebastien Bourdeauducq 2015-11-04 00:31:53 +08:00
parent c5dadf27ff
commit db111a6eb0
8 changed files with 27 additions and 60 deletions

View File

@ -5,9 +5,6 @@ OBJECTS=isr.o sdram.o main.o boot-helper-$(CPU).o boot.o dataflow.o
all: bios.bin
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
chmod -x $@
@ -26,15 +23,15 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
chmod -x $@
main.o: $(BIOS_DIRECTORY)/main.c
$(compile-dep)
$(compile)
%.o: $(BIOS_DIRECTORY)/%.c
$(compile-dep)
$(compile)
%.o: $(BIOS_DIRECTORY)/%.S
$(assemble)
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin .*~ *~
$(RM) $(OBJECTS) bios.elf bios.bin .*~ *~
.PHONY: all main.o clean
.PHONY: all clean main.o

View File

@ -45,26 +45,14 @@ LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY)
# compile and generate dependencies, based on
# http://scottmcpeak.com/autodepend/autodepend.html
define compilexx-dep
$(CX) -c $(CXXFLAGS) $(1) $< -o $*.o
@$(CX_normal) -MM $(CXXFLAGS) $(1) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
define compilexx
$(CX) -c $(CXXFLAGS) $(1) $< -o $@
endef
define compile-dep
$(CC) -c $(CFLAGS) $(1) $< -o $*.o
@$(CC_normal) -MM $(CFLAGS) $(1) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
define compile
$(CC) -c $(CFLAGS) $(1) $< -o $@
endef
define assemble
$(CC) -c $(CFLAGS) -o $*.o $<
$(CC) -c $(CFLAGS) -o $@ $<
endef

View File

@ -5,9 +5,6 @@ OBJECTS=exception.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.
all: crt0-$(CPU).o libbase.a libbase-nofloat.a
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
libbase.a: $(OBJECTS) vsnprintf.o
$(AR) crs libbase.a $(OBJECTS) vsnprintf.o
@ -15,16 +12,16 @@ libbase-nofloat.a: $(OBJECTS) vsnprintf-nofloat.o
$(AR) crs libbase-nofloat.a $(OBJECTS) vsnprintf-nofloat.o
vsnprintf-nofloat.o: $(LIBBASE_DIRECTORY)/vsnprintf.c
$(call compile-dep,-DNO_FLOAT)
$(call compile,-DNO_FLOAT)
%.o: $(LIBBASE_DIRECTORY)/%.c
$(compile-dep)
$(compile)
%.o: $(LIBBASE_DIRECTORY)/%.S
$(assemble)
.PHONY: clean
.PHONY: all clean
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) crt0-$(CPU).o vsnprintf.o vsnprintf.d vsnprintf-nofloat.o vsnprintf-nofloat.d
$(RM) $(OBJECTS) crt0-$(CPU).o vsnprintf.o vsnprintf-nofloat.o
$(RM) libbase.a libbase-nofloat.a .*~ *~

View File

@ -9,16 +9,13 @@ OBJECTS=divsi3.o modsi3.o comparesf2.o comparedf2.o negsf2.o negdf2.o addsf3.o s
all: libcompiler_rt.a
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
libcompiler_rt.a: $(OBJECTS)
$(AR) crs libcompiler_rt.a $(OBJECTS)
%.o: $(MISOC_DIRECTORY)/software/compiler_rt/lib/builtins/%.c
$(compile-dep)
$(compile)
.PHONY: clean
.PHONY: all clean
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler_rt.a .*~ *~

View File

@ -14,16 +14,13 @@ OBJECTS=dyld.o
all: $(ALL_TARGET)
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
libdyld.a: $(OBJECTS)
$(AR) crs libdyld.a $(OBJECTS)
%.o: $(LIBDYLD_DIRECTORY)/%.c
$(compile-dep)
$(compile)
.PHONY: clean
.PHONY: all clean
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) libdyld.a .*~ *~
$(RM) $(OBJECTS) libdyld.a .*~ *~

View File

@ -5,19 +5,16 @@ OBJECTS=microudp.o tftp.o
all: libnet.a
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
libnet.a: $(OBJECTS)
$(AR) crs libnet.a $(OBJECTS)
%.o: $(LIBNET_DIRECTORY)/%.c
$(compile-dep)
$(compile)
%.o: %.S
$(assemble)
.PHONY: clean
.PHONY: all clean
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libnet.a .*~ *~
$(RM) $(OBJECTS) libnet.a .*~ *~

View File

@ -17,17 +17,14 @@ OBJECTS=UnwindRegistersSave.o UnwindRegistersRestore.o UnwindLevel1.o libunwind.
all: $(ALL_TARGET)
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
libunwind.a: $(OBJECTS)
$(AR) crs libunwind.a $(OBJECTS)
%.o: $(MISOC_DIRECTORY)/software/unwinder/src/%.cpp
$(compilexx-dep)
$(compilexx)
%.o: $(MISOC_DIRECTORY)/software/unwinder/src/%.c
$(compile-dep)
$(compile)
%.o: $(MISOC_DIRECTORY)/software/unwinder/src/%.S
$(assemble)
@ -35,4 +32,4 @@ libunwind.a: $(OBJECTS)
.PHONY: clean
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libunwind.a .*~ *~
$(RM) $(OBJECTS) libunwind.a .*~ *~

View File

@ -5,9 +5,6 @@ OBJECTS=isr.o main.o
all: memtest.bin
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
chmod -x $@
@ -26,10 +23,10 @@ memtest.elf: $(OBJECTS) libs
chmod -x $@
main.o: main.c
$(compile-dep)
$(compile)
%.o: %.c
$(compile-dep)
$(compile)
%.o: %.S
$(assemble)
@ -44,7 +41,7 @@ load: memtest.bin
clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) memtest.elf memtest.bin
$(RM) $(OBJECTS) memtest.elf memtest.bin
$(RM) .*~ *~
.PHONY: all main.o clean libs load