summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:41:45 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:41:45 +0900
commit5468f737e1eb021f8a69fe3ba559c43aa22d1455 (patch)
treed84e2d9fdd6494e481dea6b35afe611db3774050 /Makefile
parent95f3fe2b800940f75949b069f50a2da4712435fd (diff)
downloadtaosc-5468f737e1eb021f8a69fe3ba559c43aa22d1455.tar.gz
Polish a tad HEAD main
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 18 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 4ee0a88..92cefaf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,15 @@
+.POSIX:
+.PHONY: all clean install uninstall
+
 CXXFLAGS += -g -std=c++23 -Wextra -Werror
-LDFLAGS += -lcommon -ldyninstAPI -linstructionAPI -lparseAPI # dyninst
-PREFIX ?= /usr/local
+LDLIBS += -lcommon -ldyninstAPI -linstructionAPI -lparseAPI # dyninst
 
-BIN := fix scout synth
-BIN_PREFIX := $(DESTDIR)$(PREFIX)/bin/taosc-
-DATA := collect patch
-DATA_DIR := $(DESTDIR)$(PREFIX)/share/taosc
+PREFIX ?= /usr/local
+BIN_PREFIX ::= $(DESTDIR)$(PREFIX)/bin/taosc-
+DATA_DIR ::= $(DESTDIR)$(PREFIX)/share/taosc
 
-.PHONY: all clean install
+BIN ::= fix scout synth
+DATA ::= collect patch
 
 all: $(BIN) $(DATA)
 
@@ -15,7 +17,10 @@ clean:
 	rm -f $(BIN) $(DATA)
 
 fix: fix.m4
-	m4 -D DATA_DIR=${DATA_DIR} $< > $@
+	m4 -D DATA_DIR=$(DATA_DIR) $< > $@
+
+synth: synth.py
+	link $< $@
 
 collect: collect.c
 	e9compile $<
@@ -23,10 +28,14 @@ collect: collect.c
 patch: patch.c
 	e9compile $<
 
-install: $(addprefix $(BIN_PREFIX),$(BIN)) $(addprefix $(DATA_DIR)/,$(DATA))
+install: $(BIN:%=$(BIN_PREFIX)%) $(DATA:%=$(DATA_DIR)/%)
 
 $(BIN_PREFIX)%: %
 	install -Dm 755 $< $@
 
 $(DATA_DIR)/%: %
 	install -Dm 644 $< $@
+
+uninstall:
+	rm -f $(BIN:%=$(BIN_PREFIX)%) $(DATA:%=$(DATA_DIR)/%)
+	rmdir $(DATA_DIR)