# File: Makefile.std # Standard makefile for Angband. # # This makefile probably requires GNU make. # # This makefile is intended for use with Unix machines running X11, SDL or # (n)curses. You can choose which you want to compile for below. # # You can also place your alterations to a file in the src/ directory called # "config", in which case that file will override what is specified here. # #### Things you should, or could, change #### # What systems to try. # # By default, this tries to compile both the X11 and "curses" terminal mode # ports in the same executable. # Recent, known-to-work ports # Support X11 (main-x11.c) if SYS_x11 is set # You may have to add various X11 include/library directories to the # "CFLAGS", if your machine places files in a weird location, for example # " -I/usr/X11R6/include", or "-L/usr/X11R6/lib" to LIBS. # SYS_x11 = -DUSE_X11 -lX11 # Support curses console mode (main-gcu.c) if SYS_gcu is set # If this fails, try the alternate below SYS_gcu = -DUSE_GCU -DUSE_NCURSES -lncursesw #SYS_gcu = -DUSE_GCU -lcurses -ltermcap # Support SDL frontend (main-sdl.c) if SYS_sdl is set # SYS_sdl = -DUSE_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_ttf -lSDL_image # Support stats pseudo-frontend if SYS_stats and SYS_stats_objs are set # If sqlite3's header, sqlite3.h, isn't in the compiler's default path for # include files, you'll have to change CFLAGS so directory which has the header # is searched (i.e. if it's in /some/nonstandard/path/include then you'd add # -I/some/nonstandard/path/include to CFLAGS for most compilers). If sqlite3's # library, libsqlite3.so or libsqlite3.a, isn't in the compiler's default path # for libraries, you'll have to change LIBS so that directory with the library # is searched (i.e. if it's in /some/nonstandarad/path/lib then you'd add # -L/some/nonstandard/path/lib to LIBS for most compilers). # SYS_stats = -DUSE_STATS -lsqlite3 -lm # SYS_stats_objs = $(STATSMAINFILES) # Support SDL_mixer for sound if SOUND_sdl and SOUND_sdl_objs are set #SOUND_sdl = -DSOUND -DSOUND_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_mixer #SOUND_sdl_objs = $(SNDSDLFILES) # Basic compiler stuff CC = gcc 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 CFLAGS = -O0 -g $(WARNINGS) # Add additional search directives here # Example: -I/usr/X11R6/include -I/usr/include/ncurses INCLUDES = -I. # Example: -L/usr/X11R6/lib LIBS = #### Things you probably shouldn't change, unless there is a problem #### # Import user prefs # If you don't want to edit this file, put your module redefinitions # and build flags in "./config" -include config # Extract CFLAGS and LIBS from the system definitions MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_sdl) $(SOUND_sdl) $(SYS_stats) CFLAGS += $(patsubst -l%,,$(MODULES)) $(INCLUDES) -DPRIVATE_USER_PATH="\"~/.angband\"" LIBS += $(patsubst -D%,,$(patsubst -I%,, $(MODULES))) # Object definitions OBJS = $(BASEOBJS) main.o $(SYS_stats_objs) main-gcu.o main-x11.o main-sdl.o $(SOUND_sdl_objs) #### Targets and objects ##### # By default, copy the executable to ../ so that you don't find # yourself debugging a stale copy. default: install # Makefile.inc contains an up-to-date set of object files to compile, so # we include it include Makefile.inc # Version info EXE = $(PROGNAME) # # Targets # # Build the "Angband" program $(EXE): $(OBJS) @$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS) # Install the game. install: ../$(EXE) docs: doc/index.html ../$(EXE): $(EXE) cp $(EXE) .. # Clean up old junk clean: -rm -f $(OBJS) $(EXE) # make a distribution TILESET_DIRS = lib/tiles/adam-bolt lib/tiles/gervais lib/tiles/nomad \ lib/tiles/old lib/tiles/shockbolt DIRS = lib/gamedata lib/customize lib/help lib/screens lib/fonts lib/tiles \ $(TILESET_DIRS) lib/sounds lib/icons lib/user lib/user/panic \ lib/user/save lib/user/scores TMPDIR = ./$(EXE)-$(VERSION) dist: @-rm -rf $(TMPDIR) @echo making directories... @for i in $(DIRS) ; do mkdir -p $(TMPDIR)/$$i ; done @echo copying files... @cp ../lib/gamedata/*.txt $(TMPDIR)/lib/gamedata @cp ../lib/screens/*.txt $(TMPDIR)/lib/screens @cp ../lib/help/*.txt $(TMPDIR)/lib/help @cp ../lib/customize/*.prf $(TMPDIR)/lib/customize @cp ../lib/fonts/*.fon $(TMPDIR)/lib/fonts @cp ../lib/icons/*.png $(TMPDIR)/lib/icons @echo attempting to install sound and graphics @-cp ../lib/sounds/*.mp3 $(TMPDIR)/lib/sounds @-cp ../lib/tiles/list.txt $(TMPDIR)/lib/tiles @for i in $(TILESET_DIRS) ; do cp ../$$i/*.png ../$$i/*.prf $(TMPDIR)/$$i ; done @cp ../changes.txt ../README.md $(TMPDIR) @cp $(EXE) $(TMPDIR) tar czf ../$(EXE)-$(VERSION).tar.gz $(TMPDIR) rm -rf $(TMPDIR) # Verify module arguments args: @echo CFLAGS = $(CFLAGS) @echo LDFLAGS = $(LDFLAGS) @echo LIBS = $(LIBS) # Generate dependencies automatically depend: makedepend -D__MAKEDEPEND__ $(SRCS) # Some file dependencies %.o: %.c @printf "%10s %-20s\n" CC $< @$(CC) $(CFLAGS) -o $@ -c $< # X11 dependencies main-x11.o: $(HEADERS) main.h # Basic dependencies for main-xxx.c, main.c $(MAINOBJS) : main.h $(HEADERS) # fake Dependency doc/index.html: $(HEADERS) doxygen doc/doxygen.conf