Debian Codegraph @

src/Makefile.std

raw ◀ ▶
1 Debian patch touch this file
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 @$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS)
110
111 # Install the game.
112 install: ../$(EXE)
113
114 docs: doc/index.html
115
116 ../$(EXE): $(EXE)
117 cp $(EXE) ..
118
119 # Clean up old junk
120 clean:
121 -rm -f $(OBJS) $(EXE)
122
123 # make a distribution
124 TILESET_DIRS = lib/tiles/adam-bolt lib/tiles/gervais lib/tiles/nomad \
125 lib/tiles/old lib/tiles/shockbolt
126 DIRS = lib/gamedata lib/customize lib/help lib/screens lib/fonts lib/tiles \
127 $(TILESET_DIRS) lib/sounds lib/icons lib/user lib/user/panic \
128 lib/user/save lib/user/scores
129
130 TMPDIR = ./$(EXE)-$(VERSION)
131 dist:
132 @-rm -rf $(TMPDIR)
133 @echo making directories...
134 @for i in $(DIRS) ; do mkdir -p $(TMPDIR)/$$i ; done
135 @echo copying files...
136 @cp ../lib/gamedata/*.txt $(TMPDIR)/lib/gamedata
137 @cp ../lib/screens/*.txt $(TMPDIR)/lib/screens
138 @cp ../lib/help/*.txt $(TMPDIR)/lib/help
139 @cp ../lib/customize/*.prf $(TMPDIR)/lib/customize
140 @cp ../lib/fonts/*.fon $(TMPDIR)/lib/fonts
141 @cp ../lib/icons/*.png $(TMPDIR)/lib/icons
142 @echo attempting to install sound and graphics
143 @-cp ../lib/sounds/*.mp3 $(TMPDIR)/lib/sounds
144 @-cp ../lib/tiles/list.txt $(TMPDIR)/lib/tiles
145 @for i in $(TILESET_DIRS) ; do cp ../$$i/*.png ../$$i/*.prf $(TMPDIR)/$$i ; done
146 @cp ../changes.txt ../README.md $(TMPDIR)
147 @cp $(EXE) $(TMPDIR)
148 tar czf ../$(EXE)-$(VERSION).tar.gz $(TMPDIR)
149 rm -rf $(TMPDIR)
150
151
152 # Verify module arguments
153 args:
154 @echo CFLAGS = $(CFLAGS)
155 @echo LDFLAGS = $(LDFLAGS)
156 @echo LIBS = $(LIBS)
157
158
159 # Generate dependencies automatically
160 depend:
161 makedepend -D__MAKEDEPEND__ $(SRCS)
162
163
164 # Some file dependencies
165 %.o: %.c
166 @printf "%10s %-20s\n" CC $<
167 @$(CC) $(CFLAGS) -o $@ -c $<
168
169 # X11 dependencies
170 main-x11.o: $(HEADERS) main.h
171
172 # Basic dependencies for main-xxx.c, main.c
173 $(MAINOBJS) : main.h $(HEADERS)
174
175 # fake Dependency
176 doc/index.html: $(HEADERS)
177 doxygen doc/doxygen.conf