aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 7f7e6c5c2166813a01779e60cb19ac38931285f8 (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
31
32
33
# A simple Makefile for compiling small SDL projects

# set the compiler
CPP		:= g++ -x c++ -std=c++17 -c
LN	    := g++

# set the compiler flags
# DBGFLAGS := -ggdb3 -O0
DBGFLAGS := -O3
CPPFLAGS := -Wall -Iinclude ${DBGFLAGS} `sdl2-config --cflags`
LNFLAGS := -Wall ${DBGFLAGS} -lm `sdl2-config --libs` -lSDL2_image -lSDL2_ttf -lSDL2_mixer

HEADERS := include/pacman/*

obj/%.o: src/%.cpp $(HEADERS) Makefile
	$(CPP) -o $@ $(CPPFLAGS) $<

# default recipe
all: obj bin bin/pacman

bin/pacman: obj/utils.o obj/graphics.o obj/audio.o obj/maze.o obj/pacman.o obj/ghost.o obj/game.o
	$(LN) -o $@ $^ $(LNFLAGS)

obj:
	mkdir -p $@

bin:
	mkdir -p $@

clean:
	rm -rf obj bin Debug

.PHONY: all clean