~voidraven/scry

ref: a69e760069f63a5255bcc5ef18401befed629334 scry/makefile -rw-r--r-- 1.2 KiB
a69e7600 — lotus added install/uninstall location into makefile 5 months ago
                                                                                
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
CXX=c++
RM=rm -f
PREFIX=/usr/local
CXXFLAGS=--std=c++14 -pedantic -Wall -Wextra
LDFLAGS = -I include
LDFLAGS += -I tests
LDFLAGS += -I $(PREFIX)/include
LDLIBS=-L$(PREFIX)/lib -lscrypt

BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man/man1

.POSIX: all debug opt

all: scry

debug: CXXFLAGS += -save-temps -g -O0
debug: clean scry

opt: CXXFLAGS += --pipe -O2 -fpie -march=native -fstack-protector-strong
opt: LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now
opt: clean scry

scry: scry.o main.o
	$(CXX) $(LDFLAGS) -o scry scry.o main.o $(LDLIBS)

scry.o: scry.cpp
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c scry.cpp

main.o: main.cpp
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c main.cpp

clean:
	$(RM) *.o *.s *.ii

distclean: clean
	$(RM) *~ *.tar.gz scry test_scry

test: test_scry.o scry.o
	$(CXX) $(LDFLAGS) -o test_scry scry.o test_scry.o $(LDLIBS)

test_scry.o: tests/test_scry.cpp
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXXFLAGS) -c tests/test_scry.cpp

install:
	cp ./scry $(BINDIR)
	cp ./scry.1 $(MANDIR)

uninstall:
	rm $(BINDIR)/scry
	rm $(MANDIR)/scry.1

# make a source archive for distribution
dist: distclean
	tar -czvf ../scry-source.tar.gz ./
	mv ../scry-source.tar.gz ./