commit c59b83f13f6620b6864407953e4c84dca8b2140e
parent 972edc94e9e2a1a2a1b07f80a37e63d47d5d41f2
Author: Kyle Milz <milz@imac.0x30.net>
Date: Wed, 3 Mar 2021 20:03:20 -0800
make: add Makefiles
Diffstat:
7 files changed, 66 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,11 @@
+SUBDIR += bin
+# SUBDIR += gl
+SUBDIR += include
+SUBDIR += inst
+SUBDIR += lib
+SUBDIR += man
+# SUBDIR += share
+# SUBDIR += term
+
+
+.include "Makefile.in"
diff --git a/Makefile.in b/Makefile.in
@@ -0,0 +1,17 @@
+#CXX = /usr/local/bin/clang++
+CFLAGS += -Wall -W -Wcast-qual -Wwrite-strings
+CXXFLAGS += -Wall -W -Wcast-qual \
+ -std=c++14 \
+ -fno-exceptions \
+ -fno-rtti \
+ -Wno-unused-parameter \
+ -Werror=date-time \
+ -fvisibility-inlines-hidden \
+ -Wdelete-non-virtual-dtor
+
+#PREFIX != pwd
+PREFIX?= ${.CURDIR}
+
+CPPFLAGS += -I../include
+
+.include <bsd.subdir.mk>
diff --git a/bin/Makefile b/bin/Makefile
@@ -0,0 +1,12 @@
+PROGS= citrun_report citrun_wrap
+
+all: ${PROGS}
+
+citrun_wrap: wrap.sh
+ sed -e "s, PREFIX ,$(PREFIX)," ${.CURDIR}/wrap.sh > $@
+ chmod +x $@
+
+citrun_report: report.awk
+ echo "#!/usr/bin/awk -f" > $@
+ cat ${.CURDIR}/report.awk >> $@
+ chmod +x $@
diff --git a/include/Makefile b/include/Makefile
@@ -0,0 +1,7 @@
+all: citrun_h.h
+
+citrun_h.h: citrun.h
+ echo "static const char *$* = R\"(`cat ${.CURDIR}/citrun.h`)\"" > ${.CURDIR}/$@
+
+
+.include "../Makefile.in"
diff --git a/lib/citrun.h b/include/citrun.h
diff --git a/inst/Makefile b/inst/Makefile
@@ -1,27 +1,9 @@
-#CXX = /usr/local/bin/clang++
-CFLAGS += -Wall -W -Wcast-qual -Wwrite-strings
-CXXFLAGS += -Wall -W -Wcast-qual \
- -std=c++14 \
- -fno-exceptions \
- -fno-rtti \
- -Wno-unused-parameter \
- -Werror=date-time \
- -fvisibility-inlines-hidden \
- -Wdelete-non-virtual-dtor
-CXXFLAGS += -I../lib
-
LLVM_CONFIG ?= /usr/local/bin/llvm-config
-#PREFIX != pwd
-PREFIX?= ${.CURDIR}/obj
-
PROG= citrun_inst
-#all: ${PROG}
+all: ${PROG}
-#
-# citrun_inst
-#
CXXFLAGS_LLVM !!= $(LLVM_CONFIG) --cppflags
LDFLAGS !!= $(LLVM_CONFIG) --ldflags
LLVM_LDLIBS !!= $(LLVM_CONFIG) --libs
@@ -52,3 +34,6 @@ SRCS = main.cc \
citrun_inst: ${SRCS:.cc=.o}
c++ $(LDFLAGS) -o $@ $(SRCS:cc=o) $(LDLIBS)
+
+
+.include "../Makefile.in"
diff --git a/lib/Makefile b/lib/Makefile
@@ -0,0 +1,15 @@
+CFLAGS = -Wall -ansi -fPIC
+
+SRCS = unix.c citrun.c
+
+all: libcitrun.a
+
+libcitrun.a: libcitrun.a(citrun.o) libcitrun.a(unix.o)
+ ar cru $(.TARGET) $(.OODATE)
+ ranlib $(.TARGET)
+
+#unix.o: unix.c citrun.h os.h
+#citrun.o: citrun.c citrun.h os.h
+
+
+.include "../Makefile.in"