-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
executable file
·45 lines (36 loc) · 1.11 KB
/
makefile
File metadata and controls
executable file
·45 lines (36 loc) · 1.11 KB
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
CC=g++-4.7
SDLCFLAGS=$(shell sdl2-config --cflags)
PNGCFLAGS=$(shell libpng16-config --cflags)
DAVCFLAGS=
SDLLIBS=$(shell sdl2-config --libs)
PNGLIBS=$(shell libpng16-config --ldflags)
GLLIBS=-lGL -lglut
GLIBS=-lSDL2_image -lSDL2_ttf -lpthread -lz
DAVLIBS=
DAVDIR=$(shell echo ~/include)
INCDIRS=-I$(DAVDIR)
LIBDIRS=-L$(DAVDIR)/lib
CFLAGS=-std=gnu++11 -O0 -Wall -Wl,--no-as-needed -ggdb -DDEBUG $(SDLCFLAGS) $(PNGCFLAGS) $(DAVCFLAGS) $(INCDIRS)
LIBS=$(LIBDIRS) -Wl,--start-group $(DAVLIBS) $(GLIBS) $(SDLLIBS) $(PNGLIBS) $(GLLIBS) -Wl,--end-group
SRC=$(wildcard *.cc)
OBJ=$(SRC:.cc=.o)
HEADERS=$(wildcard *.h)
TEMPLATES=$(wildcard *.hpp)
SUBS=
TARGET=
%.o: %.cc $(HEADERS) $(TEMPLATES)
$(CC) -c $(CFLAGS) $< -o $@
%.a:
$(MAKE) -C $(@:.a=)/
cp $(@:.a=)/*.a .
%.clean:
-$(MAKE) -C $(@:.clean=)/ clean
$(TARGET): logs $(SUBS) $(OBJ)
$(CC) $(OBJ) -Wl,--start-group $(shell find -maxdepth 1 -name "*.a") -Wl,--end-group -o $(TARGET) $(LIBS)
.PHONY: logs clean cleanlibs
logs:
for file in *.log; do if [ -f "$$file" ]; then mv "$$file" logs/; fi; done
cleanlibs:
rm -f *.a
clean: logs $(SUBS:.a=.clean)
rm -f *.o $(TARGET)