-
Notifications
You must be signed in to change notification settings - Fork 81
/
Makefile
50 lines (43 loc) · 1.14 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
CXXFLAGS += -std=c++11
PREFIX?=/usr/local
ifneq ($(wildcard src/Simulator/.*),)
$(info Compiling with SFML flags)
LDFLAGS = -pthread -lsfml-network -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
else
$(info Compiling without SFML flags)
LDFLAGS = -pthread
endif
$(info $(LDFLAGS))
SOURCES=$(shell find src/ -name "*.cpp")
OBJECTS=$(SOURCES:%.cpp=%.o)
BINS=$(OBJECTS:src/%=bin/%)
TARGET=bin/foo.o
LIB=build/fido.a
.PHONY: all
all: $(TARGET)
$(TARGET): $(OBJECTS)
@mkdir -p bin/
@cp src/*.o bin/
ifneq ($(LDFLAGS), -pthread)
@mkdir -p bin/Simulator/
@cp src/Simulator/*.o bin/Simulator/
endif
$(LINK.cpp) $(BINS) $(LOADLIBES) $(LDLIBS) -o $@ $(LDFLAGS)
@echo "Made object files in ../bin/"
.PHONY: clean
clean:
@rm -f $(TARGET) $(OBJECTS) $(BINS) $(LIB)
@echo "Deleted files"
@rm -rf bin/ build/
@echo "Deleted folders"
.PHONY: lib
lib: all
@mkdir -p build/
@ar rvs $(LIB) $(BINS)
@echo "Built library at $(LIB)"
.PHONY: install
install: lib
install -d $(DESTDIR)/$(PREFIX)/lib/
install $(LIB) $(DESTDIR)/$(PREFIX)/lib/
mkdir -p $(DESTDIR)/$(PREFIX)/include/Fido/
cp -r include/* $(DESTDIR)/$(PREFIX)/include/Fido/