compiler

Unnamed Compiled Systems Language Project
git clone http://frotz.net/git/compiler.git
Log | Files | Refs

Makefile (2695B)


      1 
      2 all: bin/cold bin/cast bin/cir bin/fs bin/r5d bin/r5e bin/mkinstab 
      3 	
      4 runtests: out/test/summary.txt
      5 
      6 clean:
      7 	rm -rf bin out
      8 
      9 out/compiler.src: out/compiler.txt bin/rewriter
     10 	@mkdir -p out
     11 	bin/rewriter out/compiler.txt > out/compiler.src
     12 
     13 out/compiler.txt: src/compiler.c bin/preproc
     14 	@mkdir -p out
     15 	bin/preproc < src/compiler.c > out/compiler.txt
     16 
     17 CFLAGS := -Wall -g -Iexternal/oberon-risc-emu -Isrc -fno-builtin
     18 CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable
     19 #CFLAGS := -O2
     20 
     21 CC := gcc
     22 
     23 bin/cold: src/compiler.c src/risc5dis.c out/risc5ins.h
     24 	@mkdir -p bin
     25 	$(CC) -o $@ $(CFLAGS) -Wno-unused-result -DC src/compiler.c src/risc5dis.c
     26 
     27 bin/cast: src/compiler2.c src/codegen-risc5-simple.c src/risc5dis.c out/risc5ins.h
     28 	@mkdir -p bin
     29 	$(CC) -o $@ $(CFLAGS) -Wno-unused-result -DC src/compiler2.c src/risc5dis.c
     30 
     31 bin/cir: src/compiler2.c src/codegen-ir.c src/risc5dis.c out/risc5ins.h src/ir.h
     32 	@mkdir -p bin
     33 	$(CC) -o $@ $(CFLAGS) -Wno-unused-result -DIR -DC src/compiler2.c src/risc5dis.c
     34 
     35 bin/rewriter: src/rewriter.c
     36 	@mkdir -p bin
     37 	$(CC) -o $@ $(CFLAGS) src/rewriter.c
     38 
     39 bin/preproc: src/preproc.c
     40 	@mkdir -p bin
     41 	$(CC) -o $@ $(CFLAGS) src/preproc.c
     42 
     43 bin/fs: src/fs.c src/fs.h
     44 	@mkdir -p bin
     45 	$(CC) -o $@ $(CFLAGS) src/fs.c
     46 
     47 bin/r5d: src/r5d.c src/risc5dis.c out/risc5ins.h
     48 	@mkdir -p bin
     49 	$(CC) -o $@ $(CFLAGS) src/r5d.c src/risc5dis.c
     50 
     51 RISC5EMU_SRC := \
     52 	external/oberon-risc-emu/risc5emu.c \
     53 	external/oberon-risc-emu/risc5emu-fp.c \
     54 
     55 bin/r5e: src/r5e.c src/risc5dis.c $(RISC5EMU_SRC)
     56 	@mkdir -p bin
     57 	$(CC) -o $@ $(CFLAGS) -O2 src/r5e.c src/risc5dis.c $(RISC5EMU_SRC)
     58 
     59 bin/mkinstab: src/mkinstab.c
     60 	@mkdir -p bin
     61 	$(CC) -o $@ $(CFLAGS) src/mkinstab.c
     62 
     63 out/risc5ins.h: src/risc5ins.txt bin/mkinstab
     64 	@mkdir -p out
     65 	bin/mkinstab < src/risc5ins.txt > $@
     66 
     67 # have to have two rules here otherwise tests without .log files
     68 # fail to be compiled by the rule that depends on src+log *or*
     69 # we fail to depend on the .log for tests with both...
     70 
     71 out/test/%.txt: test/%.src test/%.log bin/cold bin/r5e test/runtest.sh
     72 	@mkdir -p out/test
     73 	@rm -f $@
     74 	@test/runtest.sh $< $@
     75 
     76 out/test/%.txt: test/%.src bin/cold bin/r5e test/runtest.sh
     77 	@mkdir -p out/test
     78 	@rm -f $@
     79 	@test/runtest.sh $< $@
     80 
     81 out/test2/%.txt: test/%.src test/%.log bin/cast bin/r5e test/runtest2.sh
     82 	@mkdir -p out/test2
     83 	@rm -f $@
     84 	@test/runtest2.sh $< $@
     85 
     86 out/test2/%.txt: test/%.src bin/cast bin/r5e test/runtest2.sh
     87 	@mkdir -p out/test2
     88 	@rm -f $@
     89 	@test/runtest2.sh $< $@
     90 
     91 SRCTESTS := $(sort $(wildcard test/*.src))
     92 ALLTESTS := $(patsubst test/%.src,out/test/%.txt,$(SRCTESTS))
     93 ALLTESTS += $(patsubst test/%.src,out/test2/%.txt,$(SRCTESTS))
     94 
     95 out/test/summary.txt: $(ALLTESTS)
     96 	@cat $(ALLTESTS) > out/test/summary.txt
     97