Some Makefile love
authorYann Sionneau <yann.sionneau@gmail.com>
Fri, 10 May 2013 20:30:28 +0000 (23:30 +0300)
committerYann Sionneau <yann.sionneau@gmail.com>
Sun, 12 May 2013 12:24:18 +0000 (14:24 +0200)
Makefile
software/bios/Makefile
software/common.mak
software/libbase/Makefile
software/libcompiler-rt/Makefile
software/libnet/Makefile
software/videomixer/Makefile
tb/s6ddrphy/Makefile
tools/Makefile

index f97f84bf15024dc0bf66db6016596eae57c8292e..78d1840ced0e838c80e4a1ddb4db11fbd3a37910 100644 (file)
--- 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
index 6e4641125802c7b15b806ab8819e77c6de4cdd33..af8552e88d8cf6828ff12894daf4d0f6d0d0e770 100644 (file)
@@ -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
index 2989b51549e31aa7ee69d2c89bfb9808657c3ba2..8f6e507e001f16c039552cb1a9ea4a147c2ff56a 100644 (file)
@@ -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
index 2c070472b5f9d86069e9f8ffd23b0c336e260ffc..6988f7ae2bac9cf50fc4a38fb86e3c8bb5fb9e61 100644 (file)
@@ -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 .*~ *~
index a154fa9f8291622bbbca3ac263b5c156f34a5749..9033e0cab26eefac17bfa0faeb9ca3f9a8e6a64b 100644 (file)
@@ -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 .*~ *~
index 21af8d44712f6a05687d4b4e82ec3156d070da0b..e0f35a138810685f1c03ea570ccfaa29aad19f6b 100644 (file)
@@ -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 .*~ *~
index a2948dc730ac81c66e9cf10f08528ed4f084a241..6bc3493e0c2b288a83be53fc8659b0ed9d283108 100644 (file)
@@ -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
index 8189f571a698b26a915d0852f00dad1ed1bc23af..0cc56433ab359de7797d9a9dfd0f3087b6c20e3f 100644 (file)
@@ -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
index 582ed48ca2342aa86cfc822a5dbdcc66a27f59a6..216e33d7d79a4644af2933f62cd30406202a2683 100644 (file)
@@ -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)