fix various codegen bugs on arm64
[qbe.git] / Makefile
blob2482eb183756f7eb9dfd5c9268273a6d32f318fb
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 simpl.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 CC = cc
17 CFLAGS = -std=c99 -g -Wall -Wextra -Wpedantic
19 qbe: $(OBJ)
20 $(CC) $(LDFLAGS) $(OBJ) -o $@
22 .c.o:
23 $(CC) $(CFLAGS) -c $< -o $@
25 $(OBJ): all.h ops.h
26 $(AMD64OBJ): amd64/all.h
27 $(ARM64OBJ): arm64/all.h
28 $(RV64OBJ): rv64/all.h
29 main.o: config.h
31 config.h:
32 @case `uname` in \
33 *Darwin*) \
34 case `uname -m` in \
35 *arm64*) \
36 echo "#define Deftgt T_arm64_apple";\
37 ;; \
38 *) \
39 echo "#define Deftgt T_amd64_apple";\
40 ;; \
41 esac \
42 ;; \
43 *) \
44 case `uname -m` in \
45 *aarch64*|*arm64*) \
46 echo "#define Deftgt T_arm64"; \
47 ;; \
48 *riscv64*) \
49 echo "#define Deftgt T_rv64"; \
50 ;; \
51 *) \
52 echo "#define Deftgt T_amd64_sysv";\
53 ;; \
54 esac \
55 ;; \
56 esac > $@
58 install: qbe
59 mkdir -p "$(DESTDIR)$(BINDIR)"
60 install -m755 qbe "$(DESTDIR)$(BINDIR)/qbe"
62 uninstall:
63 rm -f "$(DESTDIR)$(BINDIR)/qbe"
65 clean:
66 rm -f *.o */*.o qbe
68 clean-gen: clean
69 rm -f config.h
71 check: qbe
72 tools/test.sh all
74 check-arm64: qbe
75 TARGET=arm64 tools/test.sh all
77 check-rv64: qbe
78 TARGET=rv64 tools/test.sh all
80 src:
81 @echo $(SRCALL)
83 80:
84 @for F in $(SRCALL); \
85 do \
86 awk "{ \
87 gsub(/\\t/, \" \"); \
88 if (length(\$$0) > $@) \
89 printf(\"$$F:%d: %s\\n\", NR, \$$0); \
90 }" < $$F; \
91 done
93 wc:
94 @wc -l $(SRCALL)
96 .PHONY: clean clean-gen check check-arm64 check-rv64 src 80 wc install uninstall