summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 33 insertions, 20 deletions
diff --git a/Makefile b/Makefile index a4fe8ff..e7429a5 100644 --- a/Makefile +++ b/Makefile
@@ -1,27 +1,40 @@
1SOURCES = mazeoflife.cpp titlestate.cpp htpstate.cpp gamestate.cpp 1PROJECT = mazeoflife
2OBJS = $(SOURCES:.cpp=.cpp.o) 2LTARGET = build/$(PROJECT)
3IMAGES = title.bmp pointer.bmp htp1.bmp htp2.bmp 3WTARGET = build/$(PROJECT).exe
4CIMAGES = $(IMAGES:.bmp=.bmp.o)
5CC = g++ 4CC = g++
6CFLAGS = `pkg-config sdl --cflags` 5WINCC = i586-mingw32msvc-g++
7LIBS = `pkg-config sdl --libs` 6FILES = $(addprefix build/,$(wildcard *.cpp))
7MODULES = $(patsubst %.cpp,%,$(FILES))
8SOURCES = $(addsuffix .o,$(MODULES))
9WINSRC = $(addsuffix win,$(SOURCES))
10IMAGES = $(wildcard *.bmp)
11CIMAGES = $(addprefix build/,$(IMAGES:.bmp=.bmp.o))
12LINCCFL = `sdl-config --cflags`
13LINLDFL = `sdl-config --libs`
14WINCCFL = `/opt/SDL-1.2.9/bin/i386-mingw32msvc-sdl-config --cflags` -DWINDOWS
15WINLDFL = `/opt/SDL-1.2.9/bin/i386-mingw32msvc-sdl-config --libs`
8 16
9mazeoflife: $(OBJS) $(CIMAGES) 17all: init $(LTARGET) $(WTARGET)
10 $(CC) $(OBJS) $(CIMAGES) $(LIBS) -o mazeoflife 18linux: init $(LTARGET)
19windows: init $(WTARGET)
11 20
12%.cpp.o: %.cpp 21init:
13 $(CC) -c $< $(CFLAGS) -o $@ 22 mkdir -p build
14 23
15%.d: %.cpp 24clean:
16 @set -e; rm -f $@; \ 25 rm -rdfv build
17 $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
18 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
19 rm -f $@.$$$$
20 26
21%.bmp.o: %.bmp 27$(LTARGET): $(SOURCES) $(CIMAGES)
22 objcopy --input binary --output elf32-i386 -B i386 $< $@ 28 $(CC) $(SOURCES) $(CIMAGES) -o $(LTARGET) $(LINLDFL)
23 29
24include $(OBJS:.cpp.o=.d) 30$(SOURCES): build/%.o: %.cpp
31 $(CC) -c $? -o $@ $(LINCCFL)
25 32
26clean: 33$(WTARGET): $(WINSRC) $(CIMAGES)
27 rm -rdfv $(OBJS) $(OBJS:.cpp.o=.d) $(CIMAGES) mazeoflife 34 $(WINCC) $(WINSRC) $(CIMAGES) -o $(WTARGET) $(WINLDFL)
35
36$(WINSRC): build/%.owin: %.cpp
37 $(WINCC) -c $? -o $@ $(WINCCFL)
38
39$(CIMAGES): build/%.bmp.o: %.bmp
40 objcopy --input binary --output elf32-i386 -B i386 $? $@