File: makefile

package info (click to toggle)
tomatoes 1.55-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,020 kB
  • ctags: 818
  • sloc: cpp: 7,388; ansic: 298; makefile: 50
file content (87 lines) | stat: -rw-r--r-- 2,068 bytes parent folder | download | duplicates (6)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# "I Have No Tomatoes" Makefile (GNU/Linux)
# Run 'make DEBUGMODE=1' if you need to debug the game.
# Or run 'make PROFILE=1' if you need to profile the game.

.PHONY: all clean veryclean rebuild compress

CC = g++
COMPRESS = upx --best
TARGET = ./tomatoes
MARCH = pentium


# Directory defines, you can use these defaults or adjust them if
# necessary. Remember to include the trailing /

# MPK directory (where 'tomatoes.mpk' is), default: ./
MPKDIR = ./

# Music directory (where the music files are), default: ./music/
MUSICDIR = ./music/

# Hiscore directory (where the hiscores are written to), default: ./
# We need read/write access!
HISCOREDIR = ./

# Config directory (where the 'config.cfg' is), default: ./
# We need read/write access!
CONFIGDIR = ./

# Override directory (unused at the moment), default: ./data/
OVERRIDEDIR = ./data/


DIR_DEFINES = -DLINUX -DMPK_DIR=\"$(MPKDIR)\" -DMUSIC_DIR=\"$(MUSICDIR)\" -DHISCORE_DIR=\"$(HISCOREDIR)\" -DCONFIG_DIR=\"$(CONFIGDIR)\" -DOVERRIDE_DIR=\"$(OVERRIDEDIR)\"


# SDL flags
SDL_FLAGS = `sdl-config --cflags`


# Debugmode stuff
ifdef DEBUGMODE
CFLAGS = -MMD -g3 -W -Wall -mcpu=$(MARCH) -DDEBUGMODE
LDFLAGS = `sdl-config --libs` -lSDL_image -lSDL_mixer -lGL -lGLU
else
ifdef PROFILE
CFLAGS = -MMD -g3 -O3 -march=$(MARCH) -Wall -pg
LDFLAGS = `sdl-config --libs` -lSDL_image -lSDL_mixer -lGL -lGLU -pg
else
CFLAGS = -MMD -O3 -march=$(MARCH) -Wall $(SDL_FLAGS)
LDFLAGS = `sdl-config --libs` -lSDL_image -lSDL_mixer -lGL -lGLU -s
endif
endif

# Source and object files
SOURCES = $(wildcard src/*.cpp)
OBJS = $(SOURCES:.cpp=.o)
OBJS := $(subst src/,obj/,$(OBJS))

# Include directories
INCLUDES = -I./include


# Targets
all: $(TARGET)

# Check dependancies
DEPS = $(subst .o,.d,$(OBJS))
-include $(DEPS)

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)

clean:
	rm -f $(OBJS) $(TARGET)

veryclean:
	rm -f $(OBJS) $(TARGET) $(DEPS)

rebuild: veryclean all

obj/%.o: src/%.cpp
	$(CC) $(CFLAGS) $(INCLUDES) $(DIR_DEFINES) -c $< -o $@

# Compress the exe with UPX
compress: $(TARGET)
	$(COMPRESS) $(TARGET)