-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
63 lines (48 loc) · 1.75 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
63
CXX = c++
LD = c++
CXXFLAGS += -Os -fno-omit-frame-pointer -Wall -std=c++17 -MD -fPIC -Wno-unused-parameter -Wno-unused-const-variable -Wno-undefined-internal -g
SOFLAGS += -shared
LDFLAGS +=
LIBRARIES +=
SOURCES := $(shell find . -name "*.cpp" ! -wholename "./tests/*" ! -name "main.cpp" ! -wholename "./main/*")
# MAINSRC := $(shell find ./main/ -name "*.cpp") main.cpp
TESTSRC := $(shell find ./tests/ -name "*.cpp")
OBJECTS := $(SOURCES:.cpp=.o)
# MAINOBJ := $(MAINSRC:.cpp=.o)
TESTOBJ := $(TESTSRC:.cpp=.o)
PREFIX ?= /usr/local
EXEC_PREFIX ?= $(PREFIX)
BINDIR ?= $(EXEC_PREFIX)/bin
LIBDIR ?= $(EXEC_PREFIX)/lib
INCLUDEDIR ?= $(PREFIX)/include
# LIBRARY = libreaver.so
# EXECUTABLE =
all: test
#library: $(LIBRARY)
# $(EXECUTABLE): $(MAINOBJ)
# $(LD) $(CXXFLAGS) $(LDFLAGS) $(MAINOBJ) -o $@ $(LIBRARIES)
#$(LIBRARY): $(OBJECTS)
# $(LD) $(CXXFLAGS) $(SOFLAGS) $(OBJECTS) -o $@ $(LIBRARIES)
test: ./tests/test
./tests/test: $(TESTOBJ) # $(LIBRARY)
$(LD) $(CXXFLAGS) $(LDFLAGS) $(TESTOBJ) -o $@ $(LIBRARIES) -lboost_system -lboost_iostreams -lboost_program_options -lboost_filesystem -pthread
install: # $(LIBRARY) # $(EXECUTABLE)
# @cp $(EXECUTABLE) $(DESTDIR)$(BINDIR)/$(EXECUTABLE)
# @cp $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY).1
# @ln -sfn $(DESTDIR)$(LIBDIR)/$(LIBRARY).1 $(DESTDIR)$(LIBDIR)/$(LIBRARY)
@mkdir -p $(DESTDIR)$(INCLUDEDIR)/reaver
@cp -RT include $(DESTDIR)$(INCLUDEDIR)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@ -I./include/reaver
./tests/%.o: ./tests/%.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@ -I./include/reaver
clean:
@find . -name "*.o" -delete
@find . -name "*.d" -delete
@rm -f $(LIBRARY)
# @rm -f $(EXECUTABLE)
@rm -f tests/test
.PHONY: install clean library test
-include $(SOURCES:.cpp=.d)
# -include $(MAINSRC:.cpp=.d)
-include $(TESTSRC:.cpp=.d)