-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile-gsl
75 lines (59 loc) · 1.91 KB
/
Makefile-gsl
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
CPPSRCS= main.cc cmdlineopts.cc readdef.cc geneticmap.cc cointerfere.cc fileorgz.cc simulate.cc bpvcffam.cc ibdseg.cc fixedcos.cc
CSRCS=
CPPOBJS= $(patsubst %.cc,%.o,$(CPPSRCS))
COBJS= $(patsubst %.c,%.o,$(CSRCS))
EXEC= ped-sim
GPP = g++
GCC = gcc
DEFINES= -DUSEGSL
CFLAGS = -Wall $(DEFINES)
CPPFLAGS = -std=c++11 $(CFLAGS)
ifdef DEBUG # to use run `make DEBUG=1`
CFLAGS += -g
else
CFLAGS += -O2
endif
# profiling: run program normally then do:
# (note: I haven't read about the options below, I just found them in a
# Dr. Dobb's article.)
# `gprof -b -z hapi gmon.out`
ifdef PROFILE # to use run `make PROFILE=1
CFLAGS += -pg
endif
LIBS = -lz -lgsl
# dependency variables / commands
DEPDIR = .deps
df = $(DEPDIR)/$(*F)
all: $(EXEC)
$(EXEC): $(CPPOBJS) $(HEADERS)
$(GPP) -o $(EXEC) $(CPPOBJS) $(CFLAGS) $(LIBS)
# for minimal dependencies on libraries:
distribute: $(CPPOBJS) $(COBJS) $(HEADERS)
$(GPP) -o $(EXEC) $(CPPOBJS) $(COBJS) $(CFLAGS) $(LIBS) -static-libstdc++ -static-libgcc
# This way of building dependencies (per-file) described at
# http://make.paulandlesley.org/autodep.html
.c.o:
@mkdir -p $(DEPDIR)
$(GCC) -MMD $(CFLAGS) -o $@ -c $<
@cp $*.d $(df).P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P; \
rm -f $*.d
.cc.o:
@mkdir -p $(DEPDIR)
$(GPP) -MMD $(CPPFLAGS) -o $@ -c $<
@cp $*.d $(df).P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P; \
rm -f $*.d
# include the .P dependency files, but don't warn if they don't exist (the -)
-include $(CPPSRCS:%.cc=$(DEPDIR)/%.P)
-include $(CSRCS:%.c=$(DEPDIR)/%.P)
# The following applies if we don't use a dependency directory:
#-include $(SRCS:.cc=.P)
tags: $(SRCS) *.h
ctags --language-force=c++ --extra=+q --fields=+i --excmd=n *.c *.cc *.h
clean:
rm -f $(EXEC) $(CPPOBJS) $(COBJS)
clean-deps:
rm -f $(DEPDIR)/*.P