📄 makefile
字号:
# "I Have No Tomatoes" Makefile (Windows)
# 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++
WINDRES = windres.exe
RESFILE = resource.res
RCFILE = icon.rc
COMPRESS = upx --best
TARGET = ./bin/IHaveNoTomatoes.exe
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 = -DMPK_DIR=\"$(MPKDIR)\" -DMUSIC_DIR=\"$(MUSICDIR)\" -DHISCORE_DIR=\"$(HISCOREDIR)\" -DCONFIG_DIR=\"$(CONFIGDIR)\" -DOVERRIDE_DIR=\"$(OVERRIDEDIR)\"
# SDL include directory
SDL_INCLUDES = c:\mingw\include\SDL
# Debug mode settings
ifdef DEBUGMODE
CFLAGS = -MMD -g3 -W -Wall -mcpu=$(MARCH) -DDEBUGMODE
LDFLAGS = -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_image -lopengl32 -lglu32 -lfmod
else
# Profile mode settings
ifdef PROFILE
CFLAGS = -MMD -g3 -O3 -march=$(MARCH) -Wall -pg
LDFLAGS = -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_image -lopengl32 -lglu32 -lfmod -pg
else
# Normal build settings
CFLAGS = -MMD -O3 -march=$(MARCH) -Wall
LDFLAGS = -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_image -lopengl32 -lglu32 -lfmod -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 -I$(SDL_INCLUDES)
# Targets
all: $(TARGET)
# Check dependancies
DEPS = $(subst .o,.d,$(OBJS))
-include $(DEPS)
$(TARGET): $(OBJS) $(RESFILE)
$(CC) -o $(TARGET) $(OBJS) $(RESFILE) $(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 $@
# Resources
$(RESFILE): $(RCFILE)
$(WINDRES) -i $< -I rc -o $@ -O coff
# Compress the exe with UPX
compress: $(TARGET)
$(COMPRESS) $(TARGET)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -