-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
57 lines (45 loc) · 1.17 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
#
# http://www.gnu.org/software/make/manual/make.html
#
# creat time: 2013-1-12
# author: Sam
# mail: txgcwm@163.com
# function: compile sdl tutorial every lesson example
#
CC = g++
CFLAGS = -Wall -O2 -ggdb
CFLAGS += $(shell sdl-config --cflags)
LDFLAGS = $(shell sdl-config --libs)
LDLIBS = -lSDL_image -lSDL_ttf -lSDL_mixer -lglut -lGL -lGLU
export CC CFLAGS LDFLAGS LDLIBS
# add exclude dir to exclude_dirs
exclude_dirs :=
# get the dir which we want to compile
dirs := $(shell find . -maxdepth 1 -type d)
dirs := $(basename $(patsubst ./%,%,$(dirs)))
dirs := $(filter-out $(exclude_dirs),$(dirs))
SUBDIRS = $(dirs)
all:
@for i in $(SUBDIRS); \
do \
cp Makefile.subdir $$i/Makefile; \
make -C $$i ; \
done
clean:
@for i in $(SUBDIRS); \
do \
make -C $$i clean; \
rm -f $$i/Makefile; \
done
help:
@echo "Makefile for SDL tutorial version 1.0"
@echo "Usage: make [TARGET]"
@echo "TARGETS:"
@echo " all compile and link."
@echo " clean clean objects, the executable file and Makefile in suddir."
@echo " show show CFLAGS and LDLIBS."
@echo " help print help message."
show:
@echo "CFLAGS: " $(CFLAGS)
@echo "LDLIBS: " $(LDLIBS)
.PHONY: all clean show help