commit 3255da95486c2a975ad616b805f791f05219439c
parent 3fcb6f90bb230d7d653055f0d793c4f33a32731f
Author: Kyle Milz <milz@imac.0x30.net>
Date: Thu, 4 Mar 2021 01:04:16 -0800
make: use bsd.prog.mk and bsd.lib.mk
Diffstat:
8 files changed, 51 insertions(+), 67 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,9 +1,8 @@
SUBDIR += bin
-# SUBDIR += gl
+SUBDIR += gl
SUBDIR += include
SUBDIR += inst
SUBDIR += lib
-SUBDIR += man
# SUBDIR += share
# SUBDIR += term
@@ -32,4 +31,5 @@ SUBDIR += man
test:
prove -I.
+.include <bsd.subdir.mk>
.include "Makefile.in"
diff --git a/Makefile.in b/Makefile.in
@@ -1,4 +1,3 @@
-#CXX = /usr/local/bin/clang++
CFLAGS += -Wall -W -Wcast-qual -Wwrite-strings
CXXFLAGS += -Wall -W -Wcast-qual \
-std=c++14 \
@@ -10,8 +9,7 @@ CXXFLAGS += -Wall -W -Wcast-qual \
-Wdelete-non-virtual-dtor
#PREFIX != pwd
-PREFIX?= ${.CURDIR}
+#PREFIX?= ${.CURDIR}/..
+PREFIX= /nfs/src/citrun
CPPFLAGS += -I../include
-
-.include <bsd.subdir.mk>
diff --git a/gl/Makefile b/gl/Makefile
@@ -9,31 +9,33 @@
PROG= citrun_gl
-all: ${PROG}
-
-GL_PKGS = glu glfw3 glew glyphy freetype2 # osmesa
-GL_SRCS = gl.cc \
- gl_atlas.cc \
- gl_buffer.cc \
- gl_font.cc \
- gl_main.cc \
- gl_runtime.cc \
- gl_shader.cc \
- gl_state.cc \
- gl_view.cc \
- matrix4x4.c
+PKGS = glu glfw3 glew glyphy freetype2 # osmesa
+
+SRCS = gl.cc \
+ gl_atlas.cc \
+ gl_buffer.cc \
+ gl_font.cc \
+ gl_main.cc \
+ gl_runtime.cc \
+ gl_shader.cc \
+ gl_state.cc \
+ gl_view.cc \
+ matrix4x4.c
#Stringize gl_atlas_glsl.h : gl_atlas.glsl ;
#Stringize gl_vshader_glsl.h : gl_vshader.glsl ;
#Stringize gl_fshader_glsl.h : gl_fshader.glsl ;
-CXXFLAGS_GL != pkg-config --cflags $(GL_PKGS)
-CXXFLAGS += $(CXXFLAGS_GL) -DPREFIX=\"$(PREFIX)\"
-CPPFLAGS += -I../lib
-GL_LDLIBS !!= pkg-config --libs $(GL_PKGS)
+.SUFFIXES: .h .glsl
+.glsl.h:
+ echo "static const char *$@ = R\"(" > $@
+ cat $< >> $@
+ echo ")\";" >> $@
-citrun_gl: $(GL_SRCS:cc=o)
- $(CXX) $(GL_LDFLAGS) -o $@ $(GL_SRCS:cc=o) -lm $(GL_LDLIBS)
+CXXFLAGS_PC != pkg-config --cflags ${PKGS}
+CXXFLAGS += $(CXXFLAGS_PC)
+LDADD !!= pkg-config --libs ${PKGS}
-.include "../Makefile"
+.include "../Makefile.in"
+.include <bsd.prog.mk>
diff --git a/man/citrun_gl.1 b/gl/citrun_gl.1
diff --git a/inst/Makefile b/inst/Makefile
@@ -7,29 +7,27 @@ LLVM_CONFIG ?= /usr/local/bin/llvm-config
PROG= citrun_inst
-all: ${PROG}
-
CXXFLAGS_LLVM !!= $(LLVM_CONFIG) --cppflags
-LDFLAGS !!= $(LLVM_CONFIG) --ldflags
-LLVM_LDLIBS !!= $(LLVM_CONFIG) --libs
+LDFLAGS !!= $(LLVM_CONFIG) --ldflags
+LLVM_LDADD !!= $(LLVM_CONFIG) --libs
CXXFLAGS += $(CXXFLAGS_LLVM) -DPREFIX=\"$(PREFIX)\"
-LDLIBS = -lclangTooling \
- -lclangFrontendTool \
- -lclangFrontend \
- -lclangDriver \
- -lclangSerialization \
- -lclangCodeGen \
- -lclangParse \
- -lclangSema \
- -lclangAnalysis \
- -lclangRewrite \
- -lclangRewriteFrontend \
- -lclangEdit \
- -lclangAST \
- -lclangLex \
- -lclangBasic \
- $(LLVM_LDLIBS)
+LDADD += -lclangTooling
+LDADD += -lclangFrontendTool
+LDADD += -lclangFrontend
+LDADD += -lclangDriver
+LDADD += -lclangSerialization
+LDADD += -lclangCodeGen
+LDADD += -lclangParse
+LDADD += -lclangSema
+LDADD += -lclangAnalysis
+LDADD += -lclangRewrite
+LDADD += -lclangRewriteFrontend
+LDADD += -lclangEdit
+LDADD += -lclangAST
+LDADD += -lclangLex
+LDADD += -lclangBasic
+LDADD += $(LLVM_LDADD)
SRCS = main.cc \
fe.cc \
@@ -37,10 +35,8 @@ SRCS = main.cc \
action.cc \
visitor.cc
-citrun_inst: ${SRCS:.cc=.o}
- ${CXX} $(LDFLAGS) -o $@ $(SRCS:cc=o) $(LDLIBS)
-
-clean:
- rm -f ${PROG} *.o
+#depend:
+# ${CXX} ${CPPFLAGS} ${CXXFLAGS} -E -M ${SRCS} ${C_SRCS} > .depend
.include "../Makefile.in"
+.include <bsd.prog.mk>
diff --git a/man/citrun_inst.1 b/inst/citrun_inst.1
diff --git a/lib/Makefile b/lib/Makefile
@@ -1,18 +1,7 @@
-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
-
-clean:
- rm -f *.a *.o
+CFLAGS += -ansi -fPIC
+LIB = citrun
+SRCS = unix.c citrun.c
.include "../Makefile.in"
+.include <bsd.lib.mk>
diff --git a/man/Makefile b/man/Makefile
@@ -1 +0,0 @@
-.include "../Makefile.in"