aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 35ec6a2511610b3001adaed7a14aaa30033bdad2 (plain)
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
CXXFLAGS_BASE = -Wall -std=c++11
ifdef DEBUG
	CXXFLAGS = $(CXXFLAGS_BASE) -g
else
	CXXFLAGS = $(CXXFLAGS_BASE) -O2
endif
CXX = g++

BINARIES = engine
CXX_FILES = $(shell echo *.cpp)
H_FILES = *.h
OBJ_FILES = $(CXX_FILES:.cpp=.o)

.PHONY: all clean remake

all: $(BINARIES)

clean:
	rm -f $(BINARIES) $(OBJ_FILES)

remake: clean all

engine: $(OBJ_FILES)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJ_FILES)
ifndef DEBUG
	strip $@
endif

%.o: %.cpp %.h
	$(CXX) $(CXXFLAGS) -c -o $*.o $*.cpp