From db111a6eb0143205ada89e50d2732ebc3d485c46 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 4 Nov 2015 00:31:53 +0800 Subject: [PATCH] software/makefiles: remove dependency system, make all always a phony target --- misoc/software/bios/Makefile | 11 ++++------- misoc/software/common.mak | 22 +++++----------------- misoc/software/libbase/Makefile | 11 ++++------- misoc/software/libcompiler_rt/Makefile | 7 ++----- misoc/software/libdyld/Makefile | 9 +++------ misoc/software/libnet/Makefile | 9 +++------ misoc/software/libunwind/Makefile | 9 +++------ misoc/software/memtest/Makefile | 9 +++------ 8 files changed, 27 insertions(+), 60 deletions(-) diff --git a/misoc/software/bios/Makefile b/misoc/software/bios/Makefile index 067ab4f5a..ca23cec88 100644 --- a/misoc/software/bios/Makefile +++ b/misoc/software/bios/Makefile @@ -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 diff --git a/misoc/software/common.mak b/misoc/software/common.mak index 78c537ca5..da127a1d3 100644 --- a/misoc/software/common.mak +++ b/misoc/software/common.mak @@ -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 diff --git a/misoc/software/libbase/Makefile b/misoc/software/libbase/Makefile index bf48b25af..ade4b3ca1 100644 --- a/misoc/software/libbase/Makefile +++ b/misoc/software/libbase/Makefile @@ -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 .*~ *~ diff --git a/misoc/software/libcompiler_rt/Makefile b/misoc/software/libcompiler_rt/Makefile index 85c591dc7..45df7a119 100644 --- a/misoc/software/libcompiler_rt/Makefile +++ b/misoc/software/libcompiler_rt/Makefile @@ -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 .*~ *~ diff --git a/misoc/software/libdyld/Makefile b/misoc/software/libdyld/Makefile index 14ec99f54..c378ccdca 100644 --- a/misoc/software/libdyld/Makefile +++ b/misoc/software/libdyld/Makefile @@ -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 .*~ *~ diff --git a/misoc/software/libnet/Makefile b/misoc/software/libnet/Makefile index d38ef5b5d..f10feb0da 100644 --- a/misoc/software/libnet/Makefile +++ b/misoc/software/libnet/Makefile @@ -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 .*~ *~ diff --git a/misoc/software/libunwind/Makefile b/misoc/software/libunwind/Makefile index b35c8626a..6ebd8fb12 100644 --- a/misoc/software/libunwind/Makefile +++ b/misoc/software/libunwind/Makefile @@ -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 .*~ *~ diff --git a/misoc/software/memtest/Makefile b/misoc/software/memtest/Makefile index ea93a3aee..c7b5254aa 100644 --- a/misoc/software/memtest/Makefile +++ b/misoc/software/memtest/Makefile @@ -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