aboutsummaryrefslogtreecommitdiff
path: root/makefile
blob: 6cb1aeb6a5beb7a63a9e54e207030d8f769b4fad (plain)
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
c_mains := poiss.c svd.c timestamp.c
c_sources := $(c_mains) 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 priority

## 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 : $(c_mains:.c=)

poiss : poiss.o arg_parser.o parse_csv.o
	g++ $^ -lnlopt -o $@

svd : svd.o arg_parser.o parse_csv.o
	g++ $^ -larmadillo -o $@

timestamp: timestamp.o arg_parser.o
	$(CXX) $^ -lpthread -o $@

priority:
	sudo setcap CAP_SYS_NICE=ep ./timestamp

ifndef NO_DOT_D
  include $(c_sources:.c=.d)
endif