summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-02-26 17:49:44 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-03-01 05:14:50 +0900
commitf6c6302192bfc6f1bfba253367317cdb52ba4370 (patch)
treeefd23ddd371ac9cd98082ca8f1b3ddfd1e97d245 /Makefile
parentc9dff9cb9c9bb9ac685d59d12f7f991c30a1cd94 (diff)
downloadroux-f6c6302192bfc6f1bfba253367317cdb52ba4370.tar.gz
Port entry point to Zig
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 11 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 71d5065..a81e46d 100644
--- a/Makefile
+++ b/Makefile
@@ -4,27 +4,29 @@
 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 \
+ZIGSRC   = src/main.zig src/cimport.zig
+COMMSRC  = 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)
+SRCALL   = $(ZIGSRC) $(COMMSRC) $(AMD64SRC) $(ARM64SRC) $(RV64SRC)
 
-qbe: $(SRCALL) all.h ops.h amd64/all.h arm64/all.h rv64/all.h
+zig-out/bin/roux: $(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"
+install: roux
+	zig build install --prefix="$(DESTDIR)$(BINDIR)"
 
 uninstall:
-	rm -f "$(DESTDIR)$(BINDIR)/qbe"
+	zig build uninstall --prefix="$(DESTDIR)$(BINDIR)"
 
 clean:
 	rm -fr qbe zig-cache zig-out
 
+qbe: zig-out/bin/roux
+	ln -fs $< $@
+
 check: qbe
 	tools/test.sh all
 
@@ -37,14 +39,4 @@ check-rv64: qbe
 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
+.PHONY: clean check check-arm64 check-rv64 src install uninstall