Makedfile: fix bootstrap2 building; refactor all: and clean: targets
1 files changed, 13 insertions(+), 11 deletions(-)

M Makefile
M Makefile +13 -11
@@ 1,7 1,10 @@ 
 AS = nasm
 ASFLAGS = -f elf64
 
-all: swapwm mandelbrot mandelbrot-asm avx bootstrap2.o playground.o foxx mandelbrot-mt
+bins = fox swapwm mandelbrot mandelbrot-mt \
+		mandelbrot-asm mandelbrot avx foxx
+		
+all: $(bins)
 
 %.o: %.asm
 			$(AS) $(ASFLAGS) -o $@ $^

          
@@ 12,12 15,12 @@ all: swapwm mandelbrot mandelbrot-asm av
 fox: fox.o bootstrap.o
 			$(LD) $(LDFLAGS) -o $@ $^
 
-bootstrap2.o: fox 
-			cat system.fox fileio.fox elf64.fox \
-			bootstrap2.fox bye.fox | ./fox
-
-bootstrap2: bootstrap.o bootstrap2.o
-			$(LD) $(LDFLAGS) -o $@ $^
+# can only be build if code that writes the object file
+# in bootstrap2.fox is enabled
+srcs-bootstrap2 = system.fox fileio.fox elf64.fox \
+			bootstrap2.fox bye.fox
+bootstrap2.o: fox $(srcs-bootstrap2) 
+			cat $(srcs-bootstrap2) | ./fox
 
 swapwm-config.fox: 
 			cp swapwm-config.def.fox swapwm-config.fox

          
@@ 52,12 55,11 @@ avx.o: fox $(srcs-avx)
 			cat $(srcs-avx) | ./fox
 			
 srcs-foxx = system.fox asm.fox fileio.fox elf64.fox \
-			bootstrap2.fox foxx.fox	bye.fox
+			bootstrap2.fox foxx.fox bye.fox
 foxx.o: fox $(srcs-foxx)
 			cat $(srcs-foxx) | ./fox
 
 clean:
-			rm -f *.o fox bootstrap2 swapwm mandelbrot avx \
-			mandelbrot-mt mandelbrot-asm mandelbrot foxx
+			rm -f *.o $(bins) bootstrap2
 
-.PHONY: all clean mandelbrot2.o bootstrap2.o
+.PHONY: all clean