Changeset 6

Show
Ignore:
Timestamp:
03/24/07 07:23:28 (2 years ago)
Author:
takkaria
Message:

Add some improvements to the new Makefile.std by pete mack.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Makefile.std

    r3 r6  
    1212# "config", in which case that file will override what is specified here. 
    1313# 
    14 # If you used to use Makefile.gtk or Makefile.lsl, then just change the below 
    15 # SYS_gtk or SYS_lsl option to "true", and set the others to "false"
     14# If you used to use Makefile.gtk or Makefile.lsl, uncomment the appropriate 
     15# lines below
    1616# 
    1717 
    1818#### Things you should, or could, change #### 
    1919 
     20 
    2021# What systems to try. 
    2122# 
    2223# By default, this tries to compile both the X11 and "curses" terminal mode 
    23 # ports in the same executable. 
    24  
    25 SYS_x11 = true 
    26 SYS_gcu = true 
    27 SYS_xaw = false 
    28 SYS_gtk = false 
    29 SYS_cap = false 
    30 SYS_lsl = false 
    31 SYS_sla = false 
    32 SYS_vcs = false  # Linux only, AFAIK 
    33 SYS_lfb = false  # Linux only 
    34 SYS_xpj = false  # Still experimental, and requires X11/Xaw/GTK to be enabled 
     24# ports in the same executable.  On Linux only, it also builds the lfb 'console'  
     25# module. 
     26 
     27# IMPORTANT: leave space between '= -D' 
     28SYS_x11 = -DUSE_X11 
     29SYS_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 
     35SYS_lfb = -DUSE_LFB # Linux only (see below) 
     36#SYS_xpj = -DUSE_XPJ # Experimental. requires X11/Xaw/GTK to be enabled 
     37 
    3538 
    3639# Basic compiler stuff 
    3740CC = gcc 
    38 CFLAGS = -Wall -O2 -g -fno-strength-reduce 
     41CFLAGS = -Wall -O2 -fno-strength-reduce 
     42EXE = angband  # Executable name 
    3943 
    4044 
     
    4448-include config 
    4549 
    46 # Eventually we'll have a mini-config tester here, but until then... 
    47  
    48 ## Disable X11 if necessary 
    49 #ifneq ($(shell $(CC) -lX11 2&>/dev/null && echo -n "c"),c) 
    50 #  SYS_x11 = false 
    51 #endif 
    52 
    53 ## Disable GCU if necessary 
    54 #ifneq ($(shell $(CC) -lncurses 2&>/dev/null && echo -n "c"),c) 
    55 #  SYS_gcu = false 
    56 #endif 
    57 
    58  
     50# Enable what needs enabling 
     51CFLAGS += $(SYS_x11)$(SYS_gcu)$(SYS_xaw)$(SYS_gtk)$(SYS_cap)$(SYS_sla)$(SYS_xpj) 
     52 
     53 
     54# Check for OS 
    5955uname = $(shell uname) 
    6056 
    61 # Disable non-Linux ports on non-Linux 
    62 ifneq ($(uname),Linux) 
    63   SYS_lfb = false 
    64  
    65 # Enable mkstemp() also 
    66 else 
    67   CFLAGS += -DHAVE_MKSTEMP 
    68 endif 
    69  
    70 # Disable XPJ without X11/Xaw/GTK 
    71 ifeq ($(SYS_x11),false) 
    72   ifeq ($(SYS_gtk),false) 
    73     ifeq ($(SYS_xaw),false) 
    74       SYS_xpj = false 
    75     endif 
    76   endif 
    77 endif 
     57# Enable linux-specific modules, if requested. 
     58ifeq ($(uname),Linux) 
     59  CFLAGS += -DHAVE_MKSTEMP $(SYS_lsl)$(SYS_lfb)$(SYS_vcs) 
     60endif 
     61 
    7862 
    7963 
     
    8771# " -I/usr/X11R6/include", or "-L/usr/X11R6/lib" to LIBS. 
    8872# 
    89 ifeq ($(SYS_x11),true) 
    90   CFLAGS += -DUSE_X11 
     73ifneq ($(SYS_x11),) 
    9174  LIBS += -lX11 
    9275endif 
     
    9780# 
    9881# If this fails, try replacing "-lncurses" with "-lcurses -ltermcap", 
    99 # and removing "-DUSE_NCURSES". 
     82# and removing "-DUSE_NCURSES" 
    10083# 
    10184# See "main-gcu.c" and "config.h" for some optional "curses" defines, 
     
    10588# You may have to add " -I/usr/include/ncurses" to CFLAGS. 
    10689# 
    107 ifeq ($(SYS_gcu),true)  
    108   CFLAGS += -DUSE_GCU -DUSE_NCURSES 
     90ifneq ($(SYS_gcu),)  
    10991  LIBS += -lncurses 
    11092endif 
     
    11496# Support main-xaw.c 
    11597# 
    116 ifeq ($(SYS_xaw),true) 
    117   CFLAGS += -DUSE_XAW 
     98ifneq ($(SYS_xaw),) 
    11899  LIBS += -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 
    119100endif 
     
    125106# Note: gtk-config adds GTK and X11 includes and libraries as appropriate. 
    126107# 
    127 ifeq ($(SYS_gtk),true) 
    128   CFLAGS += `gtk-config --cflags` -DUSE_GTK 
     108ifneq ($(SYS_gtk),) 
    129109  LIBS += `gtk-config --libs` 
    130110endif 
    131111 
    132  
    133 # 
    134 # Support main-cap.c 
    135 # 
    136 # If you want this to work on simple vt100 terminals, add " -DUSE_HARDCODE" 
    137 # to CFLAGS. 
    138 # 
    139 ifeq ($(SYS_cap),true) 
    140   CFLAGS += -DUSE_CAP 
    141   LIBS += -ltermcap 
    142 endif 
    143  
    144  
    145112# 
    146113# Support main-lsl.c 
    147114# 
    148 ifeq ($(SYS_lsl),true) 
    149   CFLAGS += -DUSE_LSL 
     115ifneq ($(SYS_lsl),) 
    150116  LIBS += -lz -lvgagl -lvga 
    151117endif 
    152118 
    153  
    154 # 
    155 # Support main-vcs.c 
    156 # 
    157 ifeq ($(SYS_vcs),true) 
    158   CFLAGS += -DUSE_VCS 
    159 endif 
    160  
    161  
    162119# 
    163120# Support main-sla.c 
    164121# 
    165 ifeq ($(SYS_sla),true) 
    166   CFLAGS += -DUSE_SLA -I/usr/include/slang 
     122ifneq ($(SYS_sla),) 
    167123  LIBS += -lslang 
    168124endif 
    169125 
    170  
    171 # 
    172 # Support main-lfb.c 
    173 # 
    174 ifeq ($(SYS_lfb),true) 
    175   CFLAGS += -DUSE_LFB 
    176 endif 
    177  
    178  
    179 # 
    180 # Support main-xpj.c 
    181 # 
    182 ifeq ($(SYS_xpj),true) 
    183   CFLAGS += -DUSE_XPJ 
    184 endif 
    185126 
    186127 
     
    228169 
    229170 
    230 ## 
    231 ## Variation -- Support fat binaries under NEXTSTEP 
    232 ## 
    233 #CFLAGS = -D"USE_GCU" -arch m68k -arch i386 
    234 #LIBS = -lcurses -ltermcap 
    235  
    236  
    237171 
    238172#### Targets and objects ##### 
    239173 
    240 # Set a target here 
    241174default: angband 
    242175 
    243 # Makefile.inc contains an up-to-date set of object files to compile, so 
    244 # we include it 
     176# Include the set of object files, and add platform files 
    245177OBJEXT=.o 
    246178include Makefile.inc 
    247  
    248179OBJS = $(BASEOBJS) \ 
    249180  main-cap.o main-gcu.o main-x11.o main-xaw.o main.o \ 
     
    252183 
    253184 
    254 
    255 # Targets 
    256 
    257  
    258 # Build the "Angband" program 
     185# Build Angband 
    259186angband: $(OBJS) 
    260         $(CC) $(CFLAGS) $(LDFLAGS) -o angband $(OBJS) $(LIBS) 
     187        $(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS) 
    261188 
    262189# Install the game. 
    263 install: ../angband 
    264  
    265 ../angband: angband 
    266         cp angband .. 
     190install: ../$(EXE) 
     191 
     192../$(EXE): $(EXE) 
     193        cp $(EXE) ../ 
    267194 
    268195# Clean up old junk