summary refs log tree commit diff
path: root/Makefile
blob: 71d5065e2cf5b4af30af1748696250496e6ddbb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.POSIX:
.SUFFIXES: .o .c

PREFIX = /usr/local
BINDIR = $(PREFIX)/bin

COMMSRC  = main.c util.c parse.c abi.c cfg.c mem.c ssa.c alias.c load.c \
           copy.c fold.c simpl.c live.c spill.c rega.c emit.c
AMD64SRC = amd64/targ.c amd64/sysv.c amd64/isel.c amd64/emit.c
ARM64SRC = arm64/targ.c arm64/abi.c arm64/isel.c arm64/emit.c
RV64SRC  = rv64/targ.c rv64/abi.c rv64/isel.c rv64/emit.c
SRCALL   = $(COMMSRC) $(AMD64SRC) $(ARM64SRC) $(RV64SRC)

qbe: $(SRCALL) all.h ops.h amd64/all.h arm64/all.h rv64/all.h
	zig build
	ln -fs zig-out/bin/qbe qbe

install: qbe
	mkdir -p "$(DESTDIR)$(BINDIR)"
	install -m755 qbe "$(DESTDIR)$(BINDIR)/qbe"

uninstall:
	rm -f "$(DESTDIR)$(BINDIR)/qbe"

clean:
	rm -fr qbe zig-cache zig-out

check: qbe
	tools/test.sh all

check-arm64: qbe
	TARGET=arm64 tools/test.sh all

check-rv64: qbe
	TARGET=rv64 tools/test.sh all

src:
	@echo $(SRCALL)

80:
	@for F in $(SRCALL);                       \
	do                                         \
		awk "{                             \
			gsub(/\\t/, \"        \"); \
			if (length(\$$0) > $@)     \
				printf(\"$$F:%d: %s\\n\", NR, \$$0); \
		}" < $$F;                          \
	done

.PHONY: clean clean-gen check check-arm64 src 80 install uninstall