-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
37 lines (27 loc) · 882 Bytes
/
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
TARGET = gen-dataset
LIBS = -lboost_random -lpthread
CC = g++
CFLAGS = -std=c++11 -g -O2 -Wall -Isrc/incl
SOURCE_FILES := $(shell find src/impl -name *.cpp)
HEADER_FILES := $(shell find src/incl -name *.hpp)
OBJECT_FILES := $(patsubst src/impl/%.cpp, build/%.o, $(SOURCE_FILES))
ifeq ($(PREFIX),)
PREFIX := /usr/local/bin
endif
.PHONY: default all clean install uninstall
default: $(TARGET)
all: default
static: LIBS = -static -lboost_random -Wl,--whole-archive -lpthread -Wl,--no-whole-archive
static: default
$(TARGET): $(OBJECT_FILES)
$(CC) $(OBJECT_FILES) -Wall $(LIBS) -o $@
$(OBJECT_FILES): build/%.o : src/impl/%.cpp $(HEADER_FILES)
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $(patsubst build/%.o, src/impl/%.cpp, $@) -o $@
clean:
rm -rf build
rm $(TARGET)
install: all
install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)
uninstall:
-rm -f $(DESTDIR)$(PREFIX)$(TARGET)