2 # Standard makefile for Angband.
4 # This makefile probably requires GNU make.
6 # This makefile is intended for use with Unix machines running X11, gtk or
7 # (n)curses. You can choose which you want to compile for below.
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.
13 #### Things you should, or could, change ####
16 # What systems to try.
18 # By default, this tries to compile both the X11 and "curses" terminal mode
19 # ports in the same executable. On Linux only, it also builds the lfb 'console'
23 # Recent, known-to-work ports
25 # Support X11 (main-x11.c)
26 # You may have to add various X11 include/library directories to the
27 # "CFLAGS", if your machine places files in a weird location, for example
28 # " -I/usr/X11R6/include", or "-L/usr/X11R6/lib" to LIBS.
29 SYS_x11 = -DUSE_X11 -lX11
31 # Support curses console mode (main-gcu.c)
32 # If this fails, try the alternate below
33 SYS_gcu = -DUSE_GCU -DUSE_NCURSES -lncurses
34 #SYS_gcu = -DUSE_GCU -lcurses -ltermcap
36 # Support Xaw motif (main-xaw.c)
37 #SYS_xaw = -DUSE_XAW -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11
39 # Support the GTK2 graphical tookit (main-gtk.c)
40 #SYS_gtk = -rdynamic -export-dynamic -DUSE_GTK $(shell pkg-config libglade-2.0 gtk+-2.0 --libs --cflags)
42 # Support SDL frontend
43 #SYS_sdl = -DUSE_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_ttf -lSDL_image
48 ## Support SDL_mixer for sound
49 #SOUND_sdl = -DSOUND_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_mixer
53 # Basic compiler stuff
55 CFLAGS = -Wall -O2 -Wno-unused-parameter
58 # Add additional search directives here
59 # Example: -I/usr/X11R6/include -I/usr/include/ncurses
61 # Example: -L/usr/X11R6/lib
70 #### Things you probably shouldn't change, unless there is a problem ####
73 # If you don't want to edit this file, put your module redefinitions
74 # and build flags in "./config"
78 # Extract CFLAGS and LIBS from the system definitions
79 MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_xaw) $(SYS_gtk) $(SYS_sdl) $(SOUND_sdl)
80 CFLAGS += $(patsubst -l%,,$(MODULES)) $(INCLUDES)
81 LIBS += $(patsubst -D%,,$(patsubst -I%,, $(MODULES)))
84 # Extract system we're running on
85 uname = $(shell uname -s)
87 # Enable linux-specific modules, if requested.
89 CFLAGS += -DHAVE_MKSTEMP
94 X11OBJS = maid-x11.o main-x11.o main-xaw.o main-gtk.o
95 MAINOBJS = main.o main-gcu.o main-sdl.o snd-sdl.o $(X11OBJS)
96 OBJS = $(BASEOBJS) $(MAINOBJS)
101 #### Targets and objects #####
103 # By default, copy the executable to ../ so that you don't find
104 # yourself debugging a stale copy.
107 # Makefile.inc contains an up-to-date set of object files to compile, so
116 # Build the "Angband" program
118 $(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS)
131 # make a distribution
132 DIRS = lib/apex lib/bone lib/data lib/edit lib/file lib/help lib/info \
133 lib/pref lib/save lib/user lib/xtra/sound lib/xtra/graf lib/xtra/font
135 TMPDIR = ./$(EXE)-$(VERSION)
138 @echo making directories...
139 @for i in $(DIRS) ; do mkdir -p $(TMPDIR)/$$i ; done
140 @echo copying files...
141 @cp ../lib/edit/*.txt $(TMPDIR)/lib/edit
142 @cp ../lib/file/*.txt $(TMPDIR)/lib/file
143 @cp ../lib/help/*.txt ../lib/help/*.hlp $(TMPDIR)/lib/help
144 @cp ../lib/pref/*.prf $(TMPDIR)/lib/pref
145 @cp ../lib/xtra/font/*.txt $(TMPDIR)/lib/xtra/font
146 @echo attempting to install sound and graphics
147 @-cp ../lib/xtra/sound/*.wav $(TMPDIR)/lib/xtra/sound
148 @-cp ../lib/xtra/graf/*.bmp $(TMPDIR)/lib/xtra/graf
149 @cp ../changes.txt ../readme.txt $(TMPDIR)
151 tar czf ../$(EXE)-$(VERSION).tar.gz $(TMPDIR)
155 # Verify module arguments
157 @echo CFLAGS = $(CFLAGS)
161 # Generate dependencies automatically
163 makedepend -D__MAKEDEPEND__ $(SRCS)
166 # Some file dependencies
168 $(CC) $(CFLAGS) -o $@ -c $<
171 $(X11OBJS) : $(INCS) maid-x11.h main.h
173 # Basic dependencies for main-xxx.c, main.c
174 $(MAINOBJS) : main.h $(INCS)