aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2021-10-17 10:10:18 -0700
committerJohn Denker <jsd@av8n.com>2021-10-17 11:09:24 -0700
commit74ddd0381aa1b1a90eb0d5300fa576cb2348eeac (patch)
tree72a9dded6f800467d52e479eb37574e6de5f2e6c /makefile
parent634d365a03cb0581a062cd3cf4db9ae69f1cde26 (diff)
basically functional, but still a work in progress
Diffstat (limited to 'makefile')
-rw-r--r--makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..45009b0
--- /dev/null
+++ b/makefile
@@ -0,0 +1,32 @@
+LDFLAGS := -lnlopt
+
+c_sources := poiss.c arg_parser.c parse_csv.c
+
+% : %.c # cancel built-in one-step rule
+
+%.o : %.c
+ g++ -g -O2 -Wall $< -c
+
+% : %.o
+ g++ $^ $(LDFLAGS) -o $@
+
+.PHONY : all
+
+## dependency-finding scheme (with local mods) based on:
+## http://www.gnu.org/manual/make-3.77/html_mono/make.html#SEC42
+## (requires an include statement at end of the makefile)
+%.d: %.c
+ @$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) $< \
+ | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
+ [ -s $@ ] || rm -f $@'
+
+################ end of pattern rules, start of real rules
+
+all : poiss
+
+poiss : poiss.o arg_parser.o parse_csv.o
+ g++ $^ $(LDFLAGS) -o $@
+
+ifndef NO_DOT_D
+ include $(c_sources:.c=.d)
+endif