| 1 |
# File: Makefile.std |
| 2 |
# Standard makefile for Angband. |
| 3 |
# |
| 4 |
# This makefile probably requires GNU make. |
| 5 |
# |
| 6 |
# This makefile is intended for use with Unix machines running X11, SDL or |
| 7 |
# (n)curses. You can choose which you want to compile for below. |
| 8 |
# |
| 9 |
# You can also place your alterations to a file in the src/ directory called |
| 10 |
# "config", in which case that file will override what is specified here. |
| 11 |
# |
| 12 |
|
| 13 |
#### Things you should, or could, change #### |
| 14 |
|
| 15 |
|
| 16 |
# What systems to try. |
| 17 |
# |
| 18 |
# By default, this tries to compile both the X11 and "curses" terminal mode |
| 19 |
# ports in the same executable. |
| 20 |
|
| 21 |
|
| 22 |
# Recent, known-to-work ports |
| 23 |
|
| 24 |
# Support X11 (main-x11.c) if SYS_x11 is set |
| 25 |
# You may have to add various X11 include/library directories to the |
| 26 |
# "CFLAGS", if your machine places files in a weird location, for example |
| 27 |
# " -I/usr/X11R6/include", or "-L/usr/X11R6/lib" to LIBS. |
| 28 |
# SYS_x11 = -DUSE_X11 -lX11 |
| 29 |
|
| 30 |
# Support curses console mode (main-gcu.c) if SYS_gcu is set |
| 31 |
# If this fails, try the alternate below |
| 32 |
SYS_gcu = -DUSE_GCU -DUSE_NCURSES -lncursesw |
| 33 |
#SYS_gcu = -DUSE_GCU -lcurses -ltermcap |
| 34 |
|
| 35 |
# Support SDL frontend (main-sdl.c) if SYS_sdl is set |
| 36 |
# SYS_sdl = -DUSE_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_ttf -lSDL_image |
| 37 |
|
| 38 |
# Support stats pseudo-frontend if SYS_stats and SYS_stats_objs are set |
| 39 |
# If sqlite3's header, sqlite3.h, isn't in the compiler's default path for |
| 40 |
# include files, you'll have to change CFLAGS so directory which has the header |
| 41 |
# is searched (i.e. if it's in /some/nonstandard/path/include then you'd add |
| 42 |
# -I/some/nonstandard/path/include to CFLAGS for most compilers). If sqlite3's |
| 43 |
# library, libsqlite3.so or libsqlite3.a, isn't in the compiler's default path |
| 44 |
# for libraries, you'll have to change LIBS so that directory with the library |
| 45 |
# is searched (i.e. if it's in /some/nonstandarad/path/lib then you'd add |
| 46 |
# -L/some/nonstandard/path/lib to LIBS for most compilers). |
| 47 |
# SYS_stats = -DUSE_STATS -lsqlite3 -lm |
| 48 |
# SYS_stats_objs = $(STATSMAINFILES) |
| 49 |
|
| 50 |
# Support SDL_mixer for sound if SOUND_sdl and SOUND_sdl_objs are set |
| 51 |
#SOUND_sdl = -DSOUND -DSOUND_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_mixer |
| 52 |
#SOUND_sdl_objs = $(SNDSDLFILES) |
| 53 |
|
| 54 |
|
| 55 |
# Basic compiler stuff |
| 56 |
CC = gcc |
| 57 |
WARNINGS = -W -Wall -Wextra -Wold-style-definition -Wmissing-declarations -Wredundant-decls -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-security -Winit-self -Wmissing-include-dirs -Wundef -Wmissing-format-attribute -Wnested-externs -Wunreachable-code -Wno-unused-parameter -Wno-missing-field-initializers |
| 58 |
CFLAGS = -O0 -g $(WARNINGS) |
| 59 |
|
| 60 |
# Add additional search directives here |
| 61 |
# Example: -I/usr/X11R6/include -I/usr/include/ncurses |
| 62 |
INCLUDES = -I. |
| 63 |
# Example: -L/usr/X11R6/lib |
| 64 |
LIBS = |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
#### Things you probably shouldn't change, unless there is a problem #### |
| 70 |
|
| 71 |
# Import user prefs |
| 72 |
# If you don't want to edit this file, put your module redefinitions |
| 73 |
# and build flags in "./config" |
| 74 |
-include config |
| 75 |
|
| 76 |
|
| 77 |
# Extract CFLAGS and LIBS from the system definitions |
| 78 |
MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_sdl) $(SOUND_sdl) $(SYS_stats) |
| 79 |
CFLAGS += $(patsubst -l%,,$(MODULES)) $(INCLUDES) -DPRIVATE_USER_PATH="\"~/.angband\"" |
| 80 |
LIBS += $(patsubst -D%,,$(patsubst -I%,, $(MODULES))) |
| 81 |
|
| 82 |
|
| 83 |
# Object definitions |
| 84 |
OBJS = $(BASEOBJS) main.o $(SYS_stats_objs) main-gcu.o main-x11.o main-sdl.o $(SOUND_sdl_objs) |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
#### Targets and objects ##### |
| 90 |
|
| 91 |
# By default, copy the executable to ../ so that you don't find |
| 92 |
# yourself debugging a stale copy. |
| 93 |
default: install |
| 94 |
|
| 95 |
# Makefile.inc contains an up-to-date set of object files to compile, so |
| 96 |
# we include it |
| 97 |
include Makefile.inc |
| 98 |
|
| 99 |
# Version info |
| 100 |
EXE = $(PROGNAME) |
| 101 |
|
| 102 |
|
| 103 |
# |
| 104 |
# Targets |
| 105 |
# |
| 106 |
|
| 107 |
# Build the "Angband" program |
| 108 |
$(EXE): $(OBJS) |
| 109 |
@printf "%10s %-20s\n" LINK $@ |
| 110 |
@$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS) |
| 111 |
|
| 112 |
# Install the game. |
| 113 |
install: ../$(EXE) |
| 114 |
|
| 115 |
docs: doc/index.html |
| 116 |
|
| 117 |
../$(EXE): $(EXE) |
| 118 |
cp $(EXE) .. |
| 119 |
|
| 120 |
# Clean up old junk |
| 121 |
clean: |
| 122 |
-rm -f $(OBJS) $(EXE) |
| 123 |
|
| 124 |
# make a distribution |
| 125 |
TILESET_DIRS = lib/tiles/adam-bolt lib/tiles/gervais lib/tiles/nomad \ |
| 126 |
lib/tiles/old lib/tiles/shockbolt |
| 127 |
DIRS = lib/gamedata lib/customize lib/help lib/screens lib/fonts lib/tiles \ |
| 128 |
$(TILESET_DIRS) lib/sounds lib/icons lib/user lib/user/panic \ |
| 129 |
lib/user/save lib/user/scores |
| 130 |
|
| 131 |
TMPDIR = ./$(EXE)-$(VERSION) |
| 132 |
dist: |
| 133 |
@-rm -rf $(TMPDIR) |
| 134 |
@echo making directories... |
| 135 |
@for i in $(DIRS) ; do mkdir -p $(TMPDIR)/$$i ; done |
| 136 |
@echo copying files... |
| 137 |
@cp ../lib/gamedata/*.txt $(TMPDIR)/lib/gamedata |
| 138 |
@cp ../lib/screens/*.txt $(TMPDIR)/lib/screens |
| 139 |
@cp ../lib/help/*.txt $(TMPDIR)/lib/help |
| 140 |
@cp ../lib/customize/*.prf $(TMPDIR)/lib/customize |
| 141 |
@cp ../lib/fonts/*.fon $(TMPDIR)/lib/fonts |
| 142 |
@cp ../lib/icons/*.png $(TMPDIR)/lib/icons |
| 143 |
@echo attempting to install sound and graphics |
| 144 |
@-cp ../lib/sounds/*.mp3 $(TMPDIR)/lib/sounds |
| 145 |
@-cp ../lib/tiles/list.txt $(TMPDIR)/lib/tiles |
| 146 |
@for i in $(TILESET_DIRS) ; do cp ../$$i/*.png ../$$i/*.prf $(TMPDIR)/$$i ; done |
| 147 |
@cp ../changes.txt ../README.md $(TMPDIR) |
| 148 |
@cp $(EXE) $(TMPDIR) |
| 149 |
tar czf ../$(EXE)-$(VERSION).tar.gz $(TMPDIR) |
| 150 |
rm -rf $(TMPDIR) |
| 151 |
|
| 152 |
|
| 153 |
# Verify module arguments |
| 154 |
args: |
| 155 |
@echo CFLAGS = $(CFLAGS) |
| 156 |
@echo LDFLAGS = $(LDFLAGS) |
| 157 |
@echo LIBS = $(LIBS) |
| 158 |
|
| 159 |
|
| 160 |
# Generate dependencies automatically |
| 161 |
depend: |
| 162 |
makedepend -D__MAKEDEPEND__ $(SRCS) |
| 163 |
|
| 164 |
|
| 165 |
# Some file dependencies |
| 166 |
%.o: %.c |
| 167 |
@printf "%10s %-20s\n" CC $< |
| 168 |
@$(CC) $(CFLAGS) -o $@ -c $< |
| 169 |
|
| 170 |
# X11 dependencies |
| 171 |
main-x11.o: $(HEADERS) main.h |
| 172 |
|
| 173 |
# Basic dependencies for main-xxx.c, main.c |
| 174 |
$(MAINOBJS) : main.h $(HEADERS) |
| 175 |
|
| 176 |
# fake Dependency |
| 177 |
doc/index.html: $(HEADERS) |
| 178 |
doxygen doc/doxygen.conf |