two new tests in abi5.ssa
[qbe.git] / Makefile
blob711873b41e52c38edeedc244b389377dc08fdfbd
1 BIN = qbe
3 V = @
4 OBJDIR = obj
6 SRC = main.c util.c parse.c cfg.c mem.c ssa.c alias.c load.c copy.c \
7 fold.c live.c spill.c rega.c gas.c
8 AMD64SRC = amd64/targ.c amd64/sysv.c amd64/isel.c amd64/emit.c
9 ARM64SRC = arm64/targ.c arm64/abi.c arm64/isel.c arm64/emit.c
10 RV64SRC = rv64/targ.c rv64/abi.c rv64/isel.c rv64/emit.c
11 SRCALL = $(SRC) $(AMD64SRC) $(ARM64SRC) $(RV64SRC)
13 AMD64OBJ = $(AMD64SRC:%.c=$(OBJDIR)/%.o)
14 ARM64OBJ = $(ARM64SRC:%.c=$(OBJDIR)/%.o)
15 RV64OBJ = $(RV64SRC:%.c=$(OBJDIR)/%.o)
16 OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ)
18 CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
20 $(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
21 @test -z "$(V)" || echo "ld $@"
22 $(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
24 $(OBJDIR)/%.o: %.c $(OBJDIR)/timestamp
25 @test -z "$(V)" || echo "cc $<"
26 $(V)$(CC) $(CFLAGS) -c $< -o $@
28 $(OBJDIR)/timestamp:
29 @mkdir -p $(OBJDIR)
30 @mkdir -p $(OBJDIR)/amd64
31 @mkdir -p $(OBJDIR)/arm64
32 @mkdir -p $(OBJDIR)/rv64
33 @touch $@
35 $(OBJ): all.h ops.h
36 $(AMD64OBJ): amd64/all.h
37 $(ARM64OBJ): arm64/all.h
38 $(RV64OBJ): rv64/all.h
39 $(OBJDIR)/main.o: config.h
41 config.h:
42 @case `uname` in \
43 *Darwin*) \
44 echo "#define Defasm Gasmacho"; \
45 echo "#define Deftgt T_amd64_sysv"; \
46 ;; \
47 *) \
48 echo "#define Defasm Gaself"; \
49 case `uname -m` in \
50 *aarch64*) \
51 echo "#define Deftgt T_arm64"; \
52 ;; \
53 *riscv64*) \
54 echo "#define Deftgt T_rv64"; \
55 ;; \
56 *) \
57 echo "#define Deftgt T_amd64_sysv";\
58 ;; \
59 esac \
60 ;; \
61 esac > $@
63 install: $(OBJDIR)/$(BIN)
64 mkdir -p "$(DESTDIR)/$(PREFIX)/bin/"
65 cp $< "$(DESTDIR)/$(PREFIX)/bin/"
67 uninstall:
68 rm -f "$(DESTDIR)/$(PREFIX)/bin/$(BIN)"
70 clean:
71 rm -fr $(OBJDIR)
73 clean-gen: clean
74 rm -f config.h
76 check: $(OBJDIR)/$(BIN)
77 tools/test.sh all
79 check-arm64: $(OBJDIR)/$(BIN)
80 TARGET=arm64 tools/test.sh all
82 check-rv64: $(OBJDIR)/$(BIN)
83 TARGET=rv64 tools/test.sh all
85 src:
86 @echo $(SRCALL)
88 80:
89 @for F in $(SRCALL); \
90 do \
91 awk "{ \
92 gsub(/\\t/, \" \"); \
93 if (length(\$$0) > $@) \
94 printf(\"$$F:%d: %s\\n\", NR, \$$0); \
95 }" < $$F; \
96 done
98 .PHONY: clean clean-gen check check-arm64 src 80 install uninstall