From: Yann Sionneau Date: Fri, 10 May 2013 20:30:28 +0000 (+0300) Subject: Some Makefile love X-Git-Tag: 24jan2021_ls180~2929^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=301008cd0cddacacf6208f2769868c7d39704834;p=litex.git Some Makefile love --- diff --git a/Makefile b/Makefile index f97f84bf..78d1840c 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,18 @@ +RM ?= rm -f + all: build/top.bit build/top.fpg build/top.bit build/top.bin: ./build.py build/top.fpg: build/top.bin - make -C tools + $(MAKE) -C tools tools/byteswap $< $@ load: build/top.bit jtag -n load.jtag clean: - rm -rf build/* + $(RM) -r build/* -.PHONY: load clean +.PHONY: all load clean diff --git a/software/bios/Makefile b/software/bios/Makefile index 6e464112..af8552e8 100644 --- a/software/bios/Makefile +++ b/software/bios/Makefile @@ -35,14 +35,14 @@ main.o: main.c $(assemble) libs: - make -C $(M2DIR)/software/libcompiler-rt - make -C $(M2DIR)/software/libbase - make -C $(M2DIR)/software/libnet + $(MAKE) -C $(M2DIR)/software/libcompiler-rt + $(MAKE) -C $(M2DIR)/software/libbase + $(MAKE) -C $(M2DIR)/software/libnet flash: bios.bin m1nor bios.bin clean: - rm -f $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~ -.PHONY: main.o clean libs flash +.PHONY: all main.o clean libs flash diff --git a/software/common.mak b/software/common.mak index 2989b515..8f6e507e 100644 --- a/software/common.mak +++ b/software/common.mak @@ -1,5 +1,7 @@ TARGET_PREFIX=lm32-elf- +RM ?= rm -f + CC_normal := $(TARGET_PREFIX)gcc CX_normal := $(TARGET_PREFIX)g++ AS_normal := $(TARGET_PREFIX)as diff --git a/software/libbase/Makefile b/software/libbase/Makefile index 2c070472..6988f7ae 100644 --- a/software/libbase/Makefile +++ b/software/libbase/Makefile @@ -21,4 +21,4 @@ libbase.a: $(OBJECTS) .PHONY: clean clean: - rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~ diff --git a/software/libcompiler-rt/Makefile b/software/libcompiler-rt/Makefile index a154fa9f..9033e0ca 100644 --- a/software/libcompiler-rt/Makefile +++ b/software/libcompiler-rt/Makefile @@ -22,4 +22,4 @@ libcompiler-rt.a: $(OBJECTS) .PHONY: clean clean: - rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler-rt.a .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler-rt.a .*~ *~ diff --git a/software/libnet/Makefile b/software/libnet/Makefile index 21af8d44..e0f35a13 100644 --- a/software/libnet/Makefile +++ b/software/libnet/Makefile @@ -21,4 +21,4 @@ libnet.a: $(OBJECTS) .PHONY: clean clean: - rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libnet.a .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libnet.a .*~ *~ diff --git a/software/videomixer/Makefile b/software/videomixer/Makefile index a2948dc7..6bc3493e 100644 --- a/software/videomixer/Makefile +++ b/software/videomixer/Makefile @@ -55,15 +55,15 @@ dvisampler0.o: dvisampler0.h dvisampler1.o: dvisampler1.h libs: - make -C $(M2DIR)/software/libcompiler-rt - make -C $(M2DIR)/software/libbase + $(MAKE) -C $(M2DIR)/software/libcompiler-rt + $(MAKE) -C $(M2DIR)/software/libbase load: videomixer.bin - make -C $(M2DIR)/tools + $(MAKE) -C $(M2DIR)/tools $(M2DIR)/tools/flterm --port /dev/ttyUSB0 --kernel videomixer.bin clean: - rm -f $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin .*~ *~ - rm -f dvisampler0.h dvisampler0.c dvisampler1.h dvisampler1.c + $(RM) $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin .*~ *~ + $(RM) dvisampler0.h dvisampler0.c dvisampler1.h dvisampler1.c -.PHONY: main.o clean libs load +.PHONY: all main.o clean libs load diff --git a/tb/s6ddrphy/Makefile b/tb/s6ddrphy/Makefile index 8189f571..0cc56433 100644 --- a/tb/s6ddrphy/Makefile +++ b/tb/s6ddrphy/Makefile @@ -6,6 +6,8 @@ SOURCES=tb_s6ddrphy.v ../../verilog/s6ddrphy/s6ddrphy.v \ $(XILINX)/verilog/src/unisims/OBUFT.v \ $(XILINX)/verilog/src/unisims/BUFPLL.v +RM ?= rm -f + all: tb_s6ddrphy isim: tb_s6ddrphy @@ -15,9 +17,9 @@ cversim: $(SOURCES) cver $(SOURCES) clean: - rm -f tb_s6ddrphy verilog.log s6ddrphy.vcd + $(RM) tb_s6ddrphy verilog.log s6ddrphy.vcd tb_s6ddrphy: $(SOURCES) iverilog -o tb_s6ddrphy $(SOURCES) -.PHONY: clean sim cversim +.PHONY: all clean isim cversim diff --git a/tools/Makefile b/tools/Makefile index 582ed48c..216e33d7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,6 @@ TARGETS=mkmmimg flterm byteswap CC=gcc +RM ?= rm -f all: $(TARGETS) @@ -10,7 +11,7 @@ install: mkmmimg flterm install -d /usr/local/bin install -m755 -t /usr/local/bin $^ -.PHONY: clean install +.PHONY: all clean install clean: - rm -f $(TARGETS) + $(RM) $(TARGETS)