| 27 | | # IMPORTANT: leave space between '= -D' |
|---|
| 28 | | SYS_x11 = -DUSE_X11 |
|---|
| 29 | | SYS_gcu = -DUSE_GCU -DUSE_NCURSES |
|---|
| 30 | | #SYS_xaw = -DUSE_XAW # alternate X11 library |
|---|
| 31 | | #SYS_gtk = $(shell gtk-config --cflags) -DUSE_GTK |
|---|
| 32 | | #SYS_sla = -DUSE_SLA -I/usr/include/slang |
|---|
| 33 | | #SYS_lsl = -DUSE_LSL # Linux only |
|---|
| 34 | | #SYS_vcs = -DUSE_VCS # Linux only |
|---|
| 35 | | SYS_lfb = -DUSE_LFB # Linux only (see below) |
|---|
| 36 | | #SYS_xpj = -DUSE_XPJ # Experimental. requires X11/Xaw/GTK to be enabled |
|---|
| 37 | | |
|---|
| 38 | | |
|---|
| 39 | | # Basic compiler stuff |
|---|
| 40 | | CC = gcc |
|---|
| 41 | | CFLAGS = -Wall -O2 -fno-strength-reduce |
|---|
| 42 | | EXE = angband # Executable name |
|---|
| 43 | | |
|---|
| 44 | | |
|---|
| 45 | | #### Things you probably shouldn't change, unless there is a problem #### |
|---|
| 46 | | |
|---|
| 47 | | # Import user prefs |
|---|
| 48 | | -include config |
|---|
| 49 | | |
|---|
| 50 | | # Enable what needs enabling |
|---|
| 51 | | CFLAGS += $(SYS_x11)$(SYS_gcu)$(SYS_xaw)$(SYS_gtk)$(SYS_cap)$(SYS_sla)$(SYS_xpj) |
|---|
| 52 | | |
|---|
| 53 | | |
|---|
| 54 | | # Check for OS |
|---|
| 55 | | uname = $(shell uname) |
|---|
| 56 | | |
|---|
| 57 | | # Enable linux-specific modules, if requested. |
|---|
| 58 | | ifeq ($(uname),Linux) |
|---|
| 59 | | CFLAGS += -DHAVE_MKSTEMP $(SYS_lsl)$(SYS_lfb)$(SYS_vcs) |
|---|
| 60 | | endif |
|---|
| 61 | | |
|---|
| 62 | | |
|---|
| 63 | | |
|---|
| 64 | | #### System definitions #### |
|---|
| 65 | | |
|---|
| 66 | | # |
|---|
| 67 | | # Support main-x11.c |
|---|
| 68 | | # |
|---|
| | 26 | |
|---|
| | 27 | |
|---|
| | 28 | # support X11 (main-x11.c) |
|---|
| 72 | | # |
|---|
| 73 | | ifneq ($(SYS_x11),) |
|---|
| 74 | | LIBS += -lX11 |
|---|
| | 32 | SYS_x11 = -DUSE_X11 -lX11 |
|---|
| | 33 | |
|---|
| | 34 | |
|---|
| | 35 | # support curses console mode (main-gcu.c) |
|---|
| | 36 | # If this fails, try the alternate below |
|---|
| | 37 | SYS_gcu = -DUSE_GCU -DUSE_NCURSES -lncurses |
|---|
| | 38 | #SYS_gcu = -DUSE_GCU -lcurses -ltermcap |
|---|
| | 39 | |
|---|
| | 40 | # support Xaw motif (main-xaw.c) |
|---|
| | 41 | #SYS_xaw = -DUSE_XAW -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 |
|---|
| | 42 | |
|---|
| | 43 | # Support gtk alternative x11 (main-gtk.c) |
|---|
| | 44 | #SYS_gtk = $(shell gtk-config --cflags) -DUSE_GTK $(shell gtk-config --libs) |
|---|
| | 45 | |
|---|
| | 46 | |
|---|
| | 47 | |
|---|
| | 48 | # Linux specific flags (appended conditionally below) |
|---|
| | 49 | |
|---|
| | 50 | # support raw console (main-lfb.c) |
|---|
| | 51 | SYS_lfb = -DUSE_LFB |
|---|
| | 52 | # |
|---|
| | 53 | # support linux in VGA mode (main-lsl.c) |
|---|
| | 54 | #SYS_lsl = -DUSE_LSL -lz -lvgagl -lvga |
|---|
| | 55 | |
|---|
| | 56 | |
|---|
| | 57 | # Experimental. requires X11/Xaw/GTK to be enabled (main-xpj.c) |
|---|
| | 58 | #SYS_xpj = -DUSE_xpj |
|---|
| | 59 | |
|---|
| | 60 | |
|---|
| | 61 | |
|---|
| | 62 | # Old raw tty protocols that may not work |
|---|
| | 63 | # With curses support, all are effectively superceded by USE_GCU |
|---|
| | 64 | |
|---|
| | 65 | # use direct termio on 8bit color-depth screen (main-vcs.c) |
|---|
| | 66 | #SYS_vcs = -DUSE_VCS |
|---|
| | 67 | |
|---|
| | 68 | # Unix 'slang' (Also available on OS/2) (main-sla.c) |
|---|
| | 69 | #SYS_sla = -DUSE_SLA -I/usr/include/slang -lslang |
|---|
| | 70 | |
|---|
| | 71 | # primitive termcap emulation of a vt100 (slow and unreliable) (main-cap.c) |
|---|
| | 72 | # -DUSE_HARDCODE in the unlikely event you are using a VT100 without curses |
|---|
| | 73 | #SYS_cap = -DUSE_CAP -ltermcap |
|---|
| | 74 | |
|---|
| | 75 | |
|---|
| | 76 | # linux-specific modules are appended below |
|---|
| | 77 | |
|---|
| | 78 | MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_xaw) $(SYS_gtk) $(SYS_xpj) $(SYS_sla) $(SYS_cap) |
|---|
| | 79 | |
|---|
| | 80 | MCFLAGS = $(patsubst -l%,,$(MODULES)) |
|---|
| | 81 | MLFLAGS = $(patsubst -D%,,$(patsubst -I%,, $(MODULES))) |
|---|
| | 82 | |
|---|
| | 83 | |
|---|
| | 84 | |
|---|
| | 85 | # Basic compiler stuff |
|---|
| | 86 | |
|---|
| | 87 | # Add additional search directives here |
|---|
| | 88 | # Example: -I/usr/X11R6/include -I/usr/include/ncurses |
|---|
| | 89 | INCLUDES = |
|---|
| | 90 | # Example: -L/usr/X11R6/lib |
|---|
| | 91 | LFLAGS = |
|---|
| | 92 | |
|---|
| | 93 | CC = gcc |
|---|
| | 94 | CFLAGS = -Wall $(OPT) -fno-strength-reduce $(MCFLAGS) $(INCLUDES) |
|---|
| | 95 | LIBS = $(LFLAGS) $(MLFLAGS) |
|---|
| | 96 | |
|---|
| | 97 | X11OBJS = maid-x11.o main-x11.o main-xaw.o main-gtk.o main-xpj.o |
|---|
| | 98 | MAINOBJS = $(X11OBJS) main-cap.o main-gcu.o main-gtk.o main-sla.o $(LINUXOBJ) |
|---|
| | 99 | OBJS = $(BASEOBJS) $(MAINOBJS) |
|---|
| | 100 | |
|---|
| | 101 | |
|---|
| | 102 | ifeq ($(OPT),) |
|---|
| | 103 | OPT = -O2 |
|---|
| 77 | | |
|---|
| 78 | | # |
|---|
| 79 | | # Support main-gcu.c |
|---|
| 80 | | # |
|---|
| 81 | | # If this fails, try replacing "-lncurses" with "-lcurses -ltermcap", |
|---|
| 82 | | # and removing "-DUSE_NCURSES" |
|---|
| 83 | | # |
|---|
| 84 | | # See "main-gcu.c" and "config.h" for some optional "curses" defines, |
|---|
| 85 | | # including "USE_GETCH" and "USE_CURS_SET". Note that "config.h" will |
|---|
| 86 | | # attempt to "guess" at many of these flags based on your system. |
|---|
| 87 | | # |
|---|
| 88 | | # You may have to add " -I/usr/include/ncurses" to CFLAGS. |
|---|
| 89 | | # |
|---|
| 90 | | ifneq ($(SYS_gcu),) |
|---|
| 91 | | LIBS += -lncurses |
|---|
| 92 | | endif |
|---|
| 93 | | |
|---|
| 94 | | |
|---|
| 95 | | # |
|---|
| 96 | | # Support main-xaw.c |
|---|
| 97 | | # |
|---|
| 98 | | ifneq ($(SYS_xaw),) |
|---|
| 99 | | LIBS += -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 |
|---|
| 100 | | endif |
|---|
| 101 | | |
|---|
| 102 | | |
|---|
| 103 | | # |
|---|
| 104 | | # Support main-gtk.c |
|---|
| 105 | | # |
|---|
| 106 | | # Note: gtk-config adds GTK and X11 includes and libraries as appropriate. |
|---|
| 107 | | # |
|---|
| 108 | | ifneq ($(SYS_gtk),) |
|---|
| 109 | | LIBS += `gtk-config --libs` |
|---|
| 110 | | endif |
|---|
| 111 | | |
|---|
| 112 | | # |
|---|
| 113 | | # Support main-lsl.c |
|---|
| 114 | | # |
|---|
| 115 | | ifneq ($(SYS_lsl),) |
|---|
| 116 | | LIBS += -lz -lvgagl -lvga |
|---|
| 117 | | endif |
|---|
| 118 | | |
|---|
| 119 | | # |
|---|
| 120 | | # Support main-sla.c |
|---|
| 121 | | # |
|---|
| 122 | | ifneq ($(SYS_sla),) |
|---|
| 123 | | LIBS += -lslang |
|---|
| | 106 | # Version info |
|---|
| | 107 | VERSION = 3_0_7s3 |
|---|
| | 108 | # Name of the game |
|---|
| | 109 | EXE = angband |
|---|
| | 110 | |
|---|
| | 111 | |
|---|
| | 112 | #### Things you probably shouldn't change, unless there is a problem #### |
|---|
| | 113 | |
|---|
| | 114 | # Import user prefs |
|---|
| | 115 | # If you don't want to edit this file, put your module redefinitions |
|---|
| | 116 | # and build flags in "./config" |
|---|
| | 117 | -include config |
|---|
| | 118 | |
|---|
| | 119 | |
|---|
| | 120 | uname = $(shell uname) |
|---|
| | 121 | |
|---|
| | 122 | # Enable linux-specific modules, if requested. |
|---|
| | 123 | ifeq ($(uname),Linux) |
|---|
| | 124 | MODULES += $(SYS_lsl) $(SYS_lfb) $(SYS_vcs) |
|---|
| | 125 | LINUXOBJS = main-lsl.o main-vcs.o main-lfb.o |
|---|
| | 126 | CFLAGS += -DHAVE_MKSTEMP |
|---|
| 197 | | -rm -f *.o angband |
|---|
| | 202 | -rm -f *.o $(EXE) |
|---|
| | 203 | |
|---|
| | 204 | # make a distribution |
|---|
| | 205 | DIRS = lib/apex lib/bone lib/data lib/edit lib/file lib/help lib/info \ |
|---|
| | 206 | lib/pref lib/save lib/user lib/xtra/sound lib/xtra/graf lib/xtra/font |
|---|
| | 207 | |
|---|
| | 208 | TMPDIR = ./$(EXE)$(VERSION) |
|---|
| | 209 | dist: |
|---|
| | 210 | @-rm -rf $(TMPDIR) |
|---|
| | 211 | @echo making directories... |
|---|
| | 212 | @for i in $(DIRS) ; do mkdir -p $(TMPDIR)/$$i ; done |
|---|
| | 213 | @echo copying files... |
|---|
| | 214 | @cp ../lib/edit/*.txt $(TMPDIR)/lib/edit |
|---|
| | 215 | @cp ../lib/file/*.txt $(TMPDIR)/lib/file |
|---|
| | 216 | @cp ../lib/help/*.txt ../lib/help/*.hlp $(TMPDIR)/lib/help |
|---|
| | 217 | @cp ../lib/pref/*.prf $(TMPDIR)/lib/pref |
|---|
| | 218 | @cp ../lib/xtra/font/*.txt $(TMPDIR)/lib/xtra/font |
|---|
| | 219 | @echo attempting to install sound and graphics |
|---|
| | 220 | @-cp ../lib/xtra/sound/*.wav $(TMPDIR)/lib/xtra/sound |
|---|
| | 221 | @-cp ../lib/xtra/graf/*.bmp $(TMPDIR)/lib/xtra/graf |
|---|
| | 222 | @cp $(EXE) $(TMPDIR) |
|---|
| | 223 | tar czf ../$(EXE)$(VERSION).tgz $(TMPDIR) |
|---|
| | 224 | rm -rf $(TMPDIR) |
|---|
| | 225 | |
|---|
| | 226 | |
|---|
| | 227 | # Verify module arguments |
|---|
| | 228 | args: |
|---|
| | 229 | @echo CFLAGS = $(CFLAGS) |
|---|
| | 230 | @echo LIBS = $(LIBS) |
|---|
| | 231 | |
|---|
| 208 | | maid-x11.o: maid-x11.c $(INCS) maid-x11.h |
|---|
| 209 | | main-cap.o: main-cap.c $(INCS) main.h |
|---|
| 210 | | main-gcu.o: main-gcu.c $(INCS) main.h |
|---|
| 211 | | main-gtk.o: main-gtk.c $(INCS) main.h maid-x11.h |
|---|
| 212 | | main-lsl.o: main-lsl.c $(INCS) main.h |
|---|
| 213 | | main-sla.o: main-sla.c $(INCS) main.h |
|---|
| 214 | | main-vcs.o: main-vcs.c $(INCS) main.h |
|---|
| 215 | | main-x11.o: main-x11.c $(INCS) main.h maid-x11.h |
|---|
| 216 | | main-xaw.o: main-xaw.c $(INCS) main.h maid-x11.h |
|---|
| 217 | | main-xpj.o: main-xpj.c $(INCS) main.h maid-x11.h |
|---|
| 218 | | main-lfb.o: main-lfb.c $(INCS) main.h |
|---|
| 219 | | main.o: main.c $(INCS) main.h |
|---|
| | 242 | # X11 dependencies |
|---|
| | 243 | $(X11OBJS) : $(INCS) maid-x11.h main.h |
|---|
| | 244 | |
|---|
| | 245 | # Basic dependencies for main-xxx.c, main.c |
|---|
| | 246 | $(MAINOBJS) : main.h $(INCS) |
|---|
| | 247 | |
|---|