# # UNIX make file (only tested on Linux) # # # Common source files # SRC_LIB=\ lib/box.c \ lib/cellcave.c \ lib/cellpnt.c \ lib/llist.c \ lib/path.c \ lib/rdb.c \ lib/rng.c \ lib/shake.c \ lib/wicca.c SRC_UI=\ ui/ui.c \ ui/ui_input.c \ ui/ui_cmd.c \ ui/ui_c_bar.c \ ui/ui_game.c \ ui/ui_g_adv.c \ ui/ui_info.c \ ui/ui_misc.c \ ui/ui_msg.c \ ui/ui_sym.c \ ui/ui_visio.c \ ui/ui_menu.c \ ui/ui_color.c \ ui/ui_keys.c SRC_GENERATE=\ generate/cave.c \ generate/dungeon.c \ generate/generate.c SRC_MAIN=\ actions.c \ ai.c \ area.c \ areatran.c \ career.c \ charact.c \ charadv.c \ chargen.c \ charstat.c \ cmd.c \ combat.c \ combat_c.c \ combat_r.c \ datafile.c \ death.c \ debug.c \ drugs.c \ dyn_msg.c \ economy.c \ effect.c \ equip.c \ event.c \ faction.c \ game.c \ grammar.c \ help.c \ honour.c \ inv.c \ log.c \ loadsave.c \ macro.c \ movement.c \ npc.c \ object.c \ options.c \ party.c \ pathfind.c \ percept.c \ perks.c \ prgman.c \ psychic.c \ psypower.c \ quest.c \ race.c \ random.c \ round.c \ scenario.c \ script.c \ sector.c \ talk.c \ target.c \ terrain.c \ util.c \ world.c # # goal: debug # ifeq ($(MAKECMDGOALS),debug) SRC_PLATFORM=\ platform/sdl/pl_sdl.c \ platform/unix/pl_unix.c CFLAGS+=-pipe -Wall -Wextra -ansi -pedantic -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement \ -Wshadow -Wmissing-declarations -Wold-style-definition -Wredundant-decls \ -ggdb -D_FORTIFY_SOURCE=2 -DDEBUG -I. -I./lib -I./ui -I./generate `sdl-config --cflags` LDFLAGS=-lm `sdl-config --libs` STRIP_BINARY=no # # goal: release # else ifeq ($(MAKECMDGOALS),release) SRC_PLATFORM=\ platform/sdl/pl_sdl.c \ platform/unix/pl_unix.c CFLAGS+=-std=c99 -Wall -Os -pipe -fomit-frame-pointer \ -I. -I./lib -I./ui -I./generate `sdl-config --cflags` LDFLAGS=-Wl,-O1 -lm `sdl-config --libs` STRIP_BINARY=yes endif SRC=\ $(SRC_LIB) \ $(SRC_PLATFORM) \ $(SRC_UI) \ $(SRC_GENERATE) \ $(SRC_MAIN) OBJ=$(SRC:.c=.o) EXE=./wrogue CC=cc RM=rm -f .PHONY : build build: $(EXE) @echo Build complete! ifeq ($(STRIP_BINARY),yes) @echo Stripping binary.. @strip $(EXE) endif @echo Copying files.. @cp $(EXE) .. ifeq ($(MAKECMDGOALS),release) @cp ./platform/sdl/sdl.txt .. @cp ./platform/unix/readme.txt .. @cp ./platform/unix/runwrogue.sh .. endif @echo Install complete! .PHONY: debug debug: build .PHONY: release release: build .PHONY : clean clean: -$(RM) *.o -$(RM) ./platform/sdl/*.o -$(RM) ./platform/curses/*.o -$(RM) ./lib/*.o -$(RM) ./ui/*.o -$(RM) ./generate/*.o -$(RM) ./platform/unix/*.o -$(RM) $(EXE) %.o: %.c @echo Building $< @$(CC) $(CFLAGS) -o $@ -c $< $(EXE): $(OBJ) @$(CC) $(OBJ) $(LDFLAGS) -o $@