summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-08-26 16:37:27 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-08-26 16:37:27 +0900
commit0ac8c3aa841212a193bcf027025521f7adf71255 (patch)
treec78edbb007fb24290a7cf9bd316432d1c968cbe8 /Makefile
downloadgoatc-0ac8c3aa841212a193bcf027025521f7adf71255.tar.gz
Draft base clang plugin
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..37f2fb0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+# Build recipes
+# Copyright (C) 2024  Nguyễn Gia Phong
+#
+# This file is part of GoatC.
+#
+# GoatC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GoatC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with GoatC.  If not, see <https://www.gnu.org/licenses/>.
+
+CXXFLAGS += -Wextra -Werror
+LDLIBS += $(shell llvm-config --cxxflags --ldflags)
+LDFLAGS ?= -fPIC -Wl,-undefined,dynamic_lookup
+PREFIX ?= /usr/local
+
+LIB := goatc.so
+BIN := goatcflags
+
+INSTALLED_LIB := $(addprefix $(DESTDIR)$(PREFIX)/lib/,$(LIB))
+INSTALLED_BIN := $(addprefix $(DESTDIR)$(PREFIX)/bin/,$(BIN))
+
+.PHONY: all clean install
+.SUFFIXES:
+
+all: $(LIB)
+
+goatc.so: goatc.cc
+	${CXX} ${CXXFLAGS} $< ${LDLIBS} -o $@ -shared ${LDFLAGS}
+
+install: $(INSTALLED_LIB) $(INSTALLED_BIN)
+
+${DESTDIR}${PREFIX}/lib/%: %
+	install -Dm 644 $< $@
+
+${DESTDIR}${PREFIX}/bin/%: %
+	install -Dm 755 $< $@