-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (61 loc) · 1.79 KB
/
Makefile
File metadata and controls
75 lines (61 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright 2016 Thomas E. Vaughan
#
# The present software is redistributable under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE, which must be distributed in the file, 'LICENSE',
# along with the software.
CXXFLAGS = -g -O0 -std=c++11 -Wall
CPPFLAGS = -I/usr/include/eigen3
LDLIBS = -lm
# ---------- BEG Automatic dependencies for C and C++ files. ----------
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
DEPDIR := .d
$(shell mkdir -p $(DEPDIR) >/dev/null)
SRCS=$(shell echo *.cpp)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
COMPILE.cc = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
%.o : %.c
%.o : %.c $(DEPDIR)/%.d
$(COMPILE.c) $(OUTPUT_OPTION) $<
$(POSTCOMPILE)
%.o : %.cpp
%.o : %.cpp $(DEPDIR)/%.d
$(COMPILE.cc) $(OUTPUT_OPTION) $<
$(POSTCOMPILE)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
# ---------- END Automatic dependencies for C and C++ files. ----------
PROGRAMS = sinusoid
PROG_PDF = $(PROGRAMS:=.pdf)
%.pdf : %.gpi
gnuplot $<
%.gpi : %
./$<
%.pdf : %.fig
fig2dev -L pdf $< > $@
DOCNAME = linear-regression
TEXNAME = $(DOCNAME).tex
PDFNAME = $(DOCNAME).pdf
.PHONY : all clean
all : $(PDFNAME)
$(PDFNAME) : $(TEXNAME) logo.pdf fdl-1.3.tex $(PROG_PDF)
pdflatex $(TEXNAME)
pdflatex $(TEXNAME)
sinusoid : sinusoid.o basis.o fit.o gplot.o
$(CXX) -o $@ $^ $(LDLIBS)
clean :
@rm -frv .d
@rm -fv *.aux
@rm -fv *.dat
@rm -fv *.gpi
@rm -fv *.log
@rm -fv logo.pdf
@rm -fv *.o
@rm -fv *.out
@rm -fv $(PDFNAME)
@rm -fv $(PROG_PDF)
@rm -fv $(PROGRAMS)
# This must be the last line.
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
-include $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS)))