fix allocation ordering bug in rega
[qbe.git] / Makefile
blob674f850d0b23973ca6828c098f6e4fb85648f868
1 .POSIX:
2 .SUFFIXES: .o .c
4 PREFIX = /usr/local
5 BINDIR = $(PREFIX)/bin
7 COMMOBJ = main.o util.o parse.o abi.o cfg.o mem.o ssa.o alias.o load.o \
8 copy.o fold.o live.o spill.o rega.o emit.o
9 AMD64OBJ = amd64/targ.o amd64/sysv.o amd64/isel.o amd64/emit.o
10 ARM64OBJ = arm64/targ.o arm64/abi.o arm64/isel.o arm64/emit.o
11 RV64OBJ = rv64/targ.o rv64/abi.o rv64/isel.o rv64/emit.o
12 OBJ = $(COMMOBJ) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ)
14 SRCALL = $(OBJ:.o=.c)
16 CFLAGS = $(CPPFLAGS) -Wall -Wextra -std=c99 -g -Wpedantic
18 qbe: $(OBJ)
19 $(CC) $(LDFLAGS) $(OBJ) -o $@
21 .c.o:
22 $(CC) $(CFLAGS) -c $< -o $@
24 $(OBJ): all.h ops.h
25 $(AMD64OBJ): amd64/all.h
26 $(ARM64OBJ): arm64/all.h
27 $(RV64OBJ): rv64/all.h
28 main.o: config.h
30 config.h:
31 @case `uname` in \
32 *Darwin*) \
33 case `uname -m` in \
34 *arm64*) \
35 echo "#define Deftgt T_arm64_apple";\
36 ;; \
37 *) \
38 echo "#define Deftgt T_amd64_apple";\
39 ;; \
40 esac \
41 ;; \
42 *) \
43 case `uname -m` in \
44 *aarch64*) \
45 echo "#define Deftgt T_arm64"; \
46 ;; \
47 *riscv64*) \
48 echo "#define Deftgt T_rv64"; \
49 ;; \
50 *) \
51 echo "#define Deftgt T_amd64_sysv";\
52 ;; \
53 esac \
54 ;; \
55 esac > $@
57 install: qbe
58 mkdir -p "$(DESTDIR)$(BINDIR)"
59 install -m755 qbe "$(DESTDIR)$(BINDIR)/qbe"
61 uninstall:
62 rm -f "$(DESTDIR)$(BINDIR)/qbe"
64 clean:
65 rm -f *.o */*.o qbe
67 clean-gen: clean
68 rm -f config.h
70 check: qbe
71 tools/test.sh all
73 check-arm64: qbe
74 TARGET=arm64 tools/test.sh all
76 check-rv64: qbe
77 TARGET=rv64 tools/test.sh all
79 src:
80 @echo $(SRCALL)
82 80:
83 @for F in $(SRCALL); \
84 do \
85 awk "{ \
86 gsub(/\\t/, \" \"); \
87 if (length(\$$0) > $@) \
88 printf(\"$$F:%d: %s\\n\", NR, \$$0); \
89 }" < $$F; \
90 done
92 .PHONY: clean clean-gen check check-arm64 src 80 install uninstall