-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (45 loc) · 1.35 KB
/
Makefile
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
.PHONY: default
default: all
srcdir=src
bindir=bin
incdir=inc
libdir=lib
cc=LD_LIBRARY_PATH=$(libdir) gcc
cflags=-I$(incdir) -Wall -g
exdir=ex
prefix=/usr/local
$(libdir)/libifcidc.so: $(srcdir)/ifcidc.c
mkdir -p $(libdir)
$(cc) $(cflags) -shared -fPIC -o $@ $^
all: $(libdir)/libifcidc.so
$(bindir)/ifcc: $(srcdir)/ifcc.c $(libdir)/libifcidc.so
mkdir -p $(bindir)
$(cc) $(cflags) -L$(libdir) -lifcidc -o $@ $^
all: $(bindir)/ifcc
.PHONY: test1pass
test1pass: $(bindir)/ifcc $(exdir)/uguids.txt $(exdir)/cguids.txt
$(bindir)/ifcc -c -i ex/uguids.txt | diff -q - ex/cguids.txt;\
$(bindir)/ifcc -x -i ex/cguids.txt | diff -q - ex/uguids.txt
.PHONY: test2pass
test2pass:
./bin/ifcc -c -i ex/uguids.txt | ./bin/ifcc -x | diff -q - ex/uguids.txt;\
./bin/ifcc -x -i ex/cguids.txt | ./bin/ifcc -c | diff -q - ex/cguids.txt
.PHONY: check
check: test1pass test2pass
.PHONY: install
install:
cp $(lib) $(prefix)/lib
cp $(exe) $(prefix)/bin
.PHONY: uninstall
uninstall:
rm $(prefix)/lib/libifcidc.so
rm $(prefix)/bin/ifcc
#+name: Phony-Targets
#+begin_src makefile :exports code
.PHONY: leaks
leaks:
valgrind --track-origins=yes ./$(bindir)/ifcc -c -i $(exdir)/uguids.txt -o /dev/null
valgrind --track-origins=yes ./$(bindir)/ifcc -x -i $(exdir)/cguids.txt -o /dev/null
.PHONY: clean
clean:
rm -rf $(bindir) $(incdir) $(srcdir) $(libdir) $(exdir) Makefile