diff --git a/sys/os2/Makefile.os2 b/sys/os2/Makefile.os2 index 023c31770..99af1d781 100644 --- a/sys/os2/Makefile.os2 +++ b/sys/os2/Makefile.os2 @@ -3,22 +3,11 @@ # Copyright (C) 1990, 1991, 1992, 1993, 1996 Timo Hakulinen # # Several compilers exist for OS/2 but, currently only GCC emx is tested -# and used for releases. make programs other than dmake are not tested -# and the support is left here for historic purposes. +# and used for releases. make programs other than dmake are not tested. # # Supported compilers: GCC emx 0.9g # -# NDMAKE ver 4.5, Microsoft/IBM NMAKE, or Dennis Vadura's DMAKE is -# required; old MS-MAKE will not work. To enable the appropriate -# make utility, uncomment the respective make-specific macros. If -# you plan to cross-compile in DOS, your best bet is NDMAKE, since -# it requires less memory than NMAKE. To compile in OS/2 use NMAKE, -# DMAKE or something compatible. Remember to set $(RLIBS) to real mode -# libraries if cross-compiling in DOS, and to protected mode libraries -# for compilation in OS/2. -# -# GNU MAKE for OS/2 seems to be too limited / braindamaged at the -# moment for me to bother implementing support for it. Maybe later. +# DMAKE is required. Credit for the makefile improvements goes to Pekka Rousu. # # Copy this file into $(SRC) directory, rename it to "makefile" # (important, many targets rely on it), compile and link inside @@ -48,65 +37,55 @@ # Compiler and linker selection. # +#format = omf +format = a.out + +.IF $(format) == a.out +with_x11 = yes +#debug = yes +.END + + CC = gcc # GCC +.IF $(format) == a.out LINK = gcc -#LINK = link386 # GCC OMF, CSet/2 +#LINK = link386 # GCC OMF, CSet/2 +.ELSE +LINK = link386 # GCC OMF, CSet/2 +LFLAGS = /noig /stack:40000 +.END -# -# Uncomment the following to compile for X11 and set X11ROOT apropriately -# -#WINX11OBJ01 = $(OBJ)/Window.o -#WINX11OBJ02 = $(OBJ)/dialogs.o -#WINX11OBJ03 = $(OBJ)/winX.o -#WINX11OBJ04 = $(OBJ)/winmap.o -#WINX11OBJ05 = $(OBJ)/winmenu.o -#WINX11OBJ06 = $(OBJ)/winmesg.o -#WINX11OBJ07 = $(OBJ)/winmisc.o -#WINX11OBJ08 = $(OBJ)/winstat.o -#WINX11OBJ09 = $(OBJ)/wintext.o -#WINX11OBJ10 = $(OBJ)/winval.o -#WINX11OBJ11 = $(OBJ)/tile.o -#X11ROOT = e:/xfree86 -#WINX11CFLAGS = -DUSE_XPM -DX11_GRAPHICS \ -# -I$(X11ROOT)/include -Zmtd -#WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm -L$(X11ROOT)/lib -lc_app -#WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \ -# ../win/X11/winmap.c ../win/X11/winmenu.c ../win/X11/winmesg.c \ -# ../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \ -# ../win/X11/winval.c tile.c -#WINX11OBJ = $(WINX11OBJ01) $(WINX11OBJ02) $(WINX11OBJ03) $(WINX11OBJ04) \ -# $(WINX11OBJ05) $(WINX11OBJ06) $(WINX11OBJ07) $(WINX11OBJ08) \ -# $(WINX11OBJ09) $(WINX11OBJ10) $(WINX11OBJ11) -#WINX11VARDAT=x11tiles pet_mark.xbm rip.xpm -#X11ECHO = $(CMD) @echo +.IF $(with_x11) == yes +WINX11OBJ01 = $(OBJ)/Window.o +WINX11OBJ02 = $(OBJ)/dialogs.o +WINX11OBJ03 = $(OBJ)/winX.o +WINX11OBJ04 = $(OBJ)/winmap.o +WINX11OBJ05 = $(OBJ)/winmenu.o +WINX11OBJ06 = $(OBJ)/winmesg.o +WINX11OBJ07 = $(OBJ)/winmisc.o +WINX11OBJ08 = $(OBJ)/winstat.o +WINX11OBJ09 = $(OBJ)/wintext.o +WINX11OBJ10 = $(OBJ)/winval.o +WINX11OBJ11 = $(OBJ)/tile.o +X11ROOT = e:/xfree86 +WINX11CFLAGS = -DUSE_XPM -DX11_GRAPHICS \ + -I$(X11ROOT)/include -Zmtd +WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm -L$(X11ROOT)/lib -lc_app +WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \ + ../win/X11/winmap.c ../win/X11/winmenu.c ../win/X11/winmesg.c \ + ../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \ + ../win/X11/winval.c tile.c +WINX11OBJ = $(WINX11OBJ01) $(WINX11OBJ02) $(WINX11OBJ03) $(WINX11OBJ04) \ + $(WINX11OBJ05) $(WINX11OBJ06) $(WINX11OBJ07) $(WINX11OBJ08) \ + $(WINX11OBJ09) $(WINX11OBJ10) $(WINX11OBJ11) +WINX11VARDAT=x11tiles pet_mark.xbm rip.xpm +X11ECHO = $(CMD) @echo +.END -# -# Make syntax peculiarities. -# -# Enable the uppermost eight lines for NDMAKE, the middle eight -# for NMAKE (MSC, CSet/2), and the lowermost eight for DMAKE. -# - -#MAKEB = ndmake # Executable name (change if necessary) -#CMD = # Command processor name if required -#AB = $*.c # Base name of the target in target action -#CB = $*.c # - " - dependent -#BEG = ( # Command line begin in shell one-liners -#END = ) # - " - end - " - -#SEP = ; # Command separator - " - -#P = % # Literal percent sign -#MAKEB = nmake -#CMD = -#AB = $(@B).c -#CB = $$(@B).c -#BEG = ( -#END = ) -#SEP = & -#P = %% MAKEB = dmake CMD = cmd /C AB = $(@:B).c @@ -118,8 +97,7 @@ P = % # # Most makes execute actions automatically inside a subshell, -# which makes even the shell internals work ok. This applies -# to NDMAKE and NMAKE. DMAKE wants it spelled out for it. +# which makes even the shell internals work ok. # ECHO = $(CMD) @echo @@ -168,7 +146,7 @@ LEXYYC = lexyy.c # Source tree base directory. # -NHSRC = \nethack-3.4.0 +NHSRC = \nethack # # Source directories. Makedefs hardcodes these, don't change them. @@ -197,7 +175,7 @@ WINSHARE= $(NHSRC)\win\share # Shared system files OBJ = \tmp\obj # Object files TEMP = \tmp\bin # Temporary files during make process -GAMEDIR = \games\nh34x11 # Game directory +GAMEDIR = \games\nh341x11 # Game directory PLIBP = c:\emx\lib # Protected mode C libraries RLIBP = c:\emx\lib # Possible real mode C libraries @@ -206,7 +184,7 @@ RLIBP = c:\emx\lib # Possible real mode C libraries # GAME = nethack -GAMEDES = "NetHack 3.4" +GAMEDES = "NetHack 3.4.1" # # The uppermost two lines for MSC, the middle two for GCC, and @@ -218,7 +196,7 @@ GAMEDES = "NetHack 3.4" CFLAGS = -c $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) #OPT = -s -O -o -OPT = +OPT = -o # # Compiler warning levels. These are really for development, so @@ -239,8 +217,11 @@ WARN = #-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-q # object format, the lower for Unix style a.out format. # -#GCCO = -Zomf -Zsys # GCC OMF -GCCO = # GCC a.out +.IF $(format) == omf +GCCO = -Zomf -Zsys +.ELSE +GCCO = +.END # # MSC 5.1 needs the large model first pass of the compiler. @@ -259,11 +240,13 @@ CL = # Prepare for a debugger. # -#LFLAGS = /noig /stack:40000 # GCC OMF -CDFLAGS = -O -s +.IF $(debug) == yes +CDFLAGS = LDFLAGS = -#CDFLAGS = -g # GDB (GCC a.out) -#LDFLAGS = -g # - " - +.ELSE +CDFLAGS = -O -s +LDFLAGS = -s +.END # # How to produce the most ANSI-like environment. @@ -275,8 +258,11 @@ STDC = -ansi # GCC # Possible system object files required during linking. # +.IF $(format) == omf +SYSOBJ = $(PLIBP)\crt0.obj $(PLIBP)\end.lib# GCC OMF +.ELSE SYSOBJ = # MSC, GCC a.out, CSet/2 -#SYSOBJ = $(PLIBP)\crt0.obj $(PLIBP)\end.lib# GCC OMF +.END # # Compiler library selection. Change if necessary. @@ -289,8 +275,11 @@ SYSOBJ = # MSC, GCC a.out, CSet/2 # OS/2 API entry points. # -#PLIBS = $(PLIBP)\st\c $(PLIBP)\st\c_app $(PLIBP)\c_alias $(PLIBP)\gcc $(PLIBP)\st\sys $(PLIBP)\os2 # GCC emx 0.9 OMF -PLIBS = -lgcc -lc -lgcc -los2 $(X11LIBS) # GCC a.out +.IF $(format) == omf +PLIBS = $(PLIBP)\st\c $(PLIBP)\st\c_app $(PLIBP)\c_alias $(PLIBP)\gcc $(PLIBP)\st\sys $(PLIBP)\os2 # GCC emx 0.9 OMF +.ELSE +PLIBS = -lgcc -lc -lgcc -los2 $(X11LIBS) # GCC a.out +.END # # C libraries used by makedefs, lev_comp and dgn_comp (change if @@ -311,22 +300,25 @@ WINCC = $(BEG) cd $(WIN) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ $(AB) $(END) # # Default linker skeletons. The upper six lines for everything -# that uses standard OS/2 object format (MSC, CSet/2, GCC OMF), -# the lower six for GCC a.out format. +# that uses standard OS/2 object format (GCC OMF), The lower six +# for GCC a.out format. # -#GAMELN = $(LINK) @$(TEMP)\$(GAME).rsp -#MKDFLN = $(LINK) @$(TEMP)\makedefs.rsp -#LEVCLN = $(LINK) @$(TEMP)\lev_comp.rsp -#DGNCLN = $(LINK) @$(TEMP)\dgn_comp.rsp -#RCVRLN = $(LINK) @$(TEMP)\recover.rsp -#DLBRLN = $(LINK) @$(TEMP)\dlb.rsp -GAMELN = $(CC) $(LDFLAGS) -o $(GAMEDIR)\$(GAME).exe @$(TEMP)\$(GAME).r $(PLIBS) $(WINX11CFLAGS) $(WINX11LIB) +.IF $(format) == omf +GAMELN = $(LINK) @$(TEMP)\$(GAME).rsp +MKDFLN = $(LINK) @$(TEMP)\makedefs.rsp +LEVCLN = $(LINK) @$(TEMP)\lev_comp.rsp +DGNCLN = $(LINK) @$(TEMP)\dgn_comp.rsp +RCVRLN = $(LINK) @$(TEMP)\recover.rsp +DLBRLN = $(LINK) @$(TEMP)\dlb.rsp +.ELSE +GAMELN = $(CC) $(LDFLAGS) -o $(GAMEDIR)\$(GAME).exe @$(TEMP)\$(GAME).r $(PLIBS) $(WINX11CFLAGS) $(WINX11LIB) MKDFLN = $(CC) $(LDFLAGS) -o $(TEMP)\makedefs.exe $(TEMP)\$(MKDFDEF) $(SYSOBJ) $(MAKEOBJS) $(PLIBS) LEVCLN = $(CC) $(LDFLAGS) -o $(TEMP)\lev_comp.exe $(TEMP)\$(LEVCDEF) $(SYSOBJ) $(SPLEVOBJS) $(PLIBS) DGNCLN = $(CC) $(LDFLAGS) -o $(TEMP)\dgn_comp.exe $(TEMP)\$(DGNCDEF) $(SYSOBJ) $(DGNCOMPOBJS) $(PLIBS) RCVRLN = $(CC) $(LDFLAGS) -o $(GAMEDIR)\recover.exe $(TEMP)\$(RCVRDEF) $(SYSOBJ) $(RECOVOBJS) $(PLIBS) -DLBRLN = $(CC) $(LDFLAGS) -o $(TEMP)\dlb.exe $(TEMP)\$(DLBDEF) $(SYSOBJ) $(DLBOBJS) $(PLIBS) + DLBRLN = $(CC) $(LDFLAGS) -o $(TEMP)\dlb.exe $(TEMP)\$(DLBDEF) $(SYSOBJ) $(DLBOBJS) $(PLIBS) +.END # # OS/2 module definition files for NetHack, @@ -886,6 +878,7 @@ $(TEMP)\$(GAME).r : $(HOBJ) $(TEMP)\$(GAMEDEF) $(ECHO) $(WINOBJ4) >> $@ $(ECHO) $(HHOBJ) >> $@ $(ECHO) $(RANDOM) >> $@ +.IF $(with_x11) == yes $(X11ECHO) $(WINX11OBJ01) >> $@ $(X11ECHO) $(WINX11OBJ02) >> $@ $(X11ECHO) $(WINX11OBJ03) >> $@ @@ -897,6 +890,7 @@ $(TEMP)\$(GAME).r : $(HOBJ) $(TEMP)\$(GAMEDEF) $(X11ECHO) $(WINX11OBJ09) >> $@ $(X11ECHO) $(WINX11OBJ10) >> $@ $(X11ECHO) $(WINX11OBJ11) >> $@ +.END