1#
2# =========================================================================
3# COW on Win32 Makefile
4# This makefile  is written for Watcom C++ 10.0, but it should
5# be fairly easy to convert to other compilers, mostly by changing
6# this top section of the makefile, and the link line, below
7#
8# !IFNDEF's added for MSVC - Microsoft Visual C++
9
10# For No Debugging Info invoke with   make nodebug=1
11#
12# Note: creating the environment variable NODEBUG is an
13#       alternate method to setting this option via the make command
14line.
15
16# Change this when you compile!
17CWHO = greynite@vnet.net
18
19!IFNDEF MSVC
20
21# Basic defs
22cc     = wcc386
23rc     = wrc
24hc     = whc
25link   = wlink
26implib = wlib
27compileandlink = wcl386
28
29!ELSE
30
31# Microsoft Visual C++ defs
32# hc == help compiler?
33cc     = cl
34rc     = rc
35hc     = hcw
36link   = link
37implib = lib
38compileandlink = cl
39
40!ENDIF
41
42# Compile Flags - must be specified after $(cc)
43#
44# Compiler flags (all other defaults are OK for NT):
45#   -d2      - generate debugging information
46#   -bt=nt   - compile for NT
47#   -c       - compile only
48#   -od      - no optimization
49#   -otexan  - full optimization for speed
50#   -zq      - shut up, already (no banner message)
51
52
53!IFNDEF MSVC
54
55!IFDEF nodebug
56cflags = -zq -otexan -zp4 -5 -fp3 -dWIN32
57!ELSE
58cflags = -zq -d2 -od -dWIN32
59!ENDIF
60
61!ELSE
62
63# MS Visual C++ (v4.0) options
64# /nologo   - no banner
65# /MT       - Multi-threaded app
66# /Ox       - max optimization
67# /Od       - disable optimizations
68# /G4       - 486 optimized (386 running Win32? Uh, no)
69# /c        - compile only
70# /Zi       - debugging info
71# /Fr[file] - generate browse info
72
73!IFDEF nodebug
74cflags = /nologo /MT -DWIN32 /Ox /G4
75ccompileonly = /c
76!ELSE
77cflags = /nologo /MT -DWIN32 /Od /G4 /Zi
78ccompileonly = /c
79!ENDIF
80
81!ENDIF
82
83# resource compiler
84rcvars = -DWIN32
85
86########################################
87# Link flags
88#
89
90!IFNDEF MSVC
91
92!IFDEF NODEBUG
93ldebug =
94!ELSE
95ldebug = d all
96!ENDIF
97
98!ELSE
99
100!IFDEF NODEBUG
101ldebug = /INCREMENTAL:NO
102!ELSE
103ldebug = /INCREMENTAL:NO /DEBUG
104!ENDIF
105
106!ENDIF
107########################################
108
109# declarations common to all linker options
110
111!IFNDEF MSVC
112
113lflags = op st=8192 op symf
114# subsystem dependant flags
115conlflags = $(lflags) SYS nt
116guilflags = $(lflags) SYS nt_win
117# The space is neccesary!!! -SAC
118lout      = "name "
119#GNU multi-byte precision library - for RSA
120GMPLIB = .\addon\lib\libgmp.lib
121
122!ELSE
123
124lflags = /STACK:8192
125#Dunno here...
126conlflags = $(lflags) /NODEFAULTLIB /SUBSYSTEM:CONSOLE
127guilflags = $(lflags) /SUBSYSTEM:CONSOLE
128lout      = "/OUT:"
129GMPLIB = libmp.lib libgmp.lib libcmt.lib user32.lib gdi32.lib\
130         wsock32.lib kernel32.lib winmm.lib mpr.lib
131
132!ENDIF
133
134
135#
136---------------------------------------------------------------------------
137# - Start of makefile proper
138
139INCS = -I.\win32\h
140ARCH = Intel/Win32
141
142# DEFS  = -DRSA  -DDEBUG
143DEFS = -DRSA -DDEBUG
144
145ROBJ            = check.obj colors.obj data.obj death.obj defaults.obj dmessage.obj\
146                  enter.obj findslot.obj getname.obj getship.obj helpwin.obj inform.obj\
147                  interface.obj newwin.obj option.obj planetlist.obj macrowin.obj\
148                  map.obj playerlist.obj ranklist.obj reserved.obj sintab.obj\
149                  smessage.obj socket.obj stats.obj util.obj war.obj warning.obj\
150                  udpopt.obj ping.obj pingstats.obj rotate.obj lagmeter.obj parsemeta.obj\
151                  netstat.obj netstatopt.obj spopt.obj dashboard.obj dashboard3.obj\
152                  short.obj distress.obj senddist.obj defwin.obj tools.obj sound.obj\
153                  docwin.obj cflags.obj beeplite.obj feature.obj\
154                  string_util.obj local.obj censor.obj cowmain.obj
155
156RSRC            = check.c colors.c data.c death.c defaults.c dmessage.c\
157                  enter.c findslot.c getname.c getship.c helpwin.c inform.c\
158                  input.c interface.c newwin.c option.c planetlist.c\
159                  macrowin.c map.c playerlist.c ranklist.c redraw.c\
160                  smessage.c parsemeta.c socket.c stats.c util.c war.c\
161                  warning.c udpopt.c sintab.c ping.c pingstats.c rotate.c\
162                  lagmeter.c netstat.c netstatopt.c spopt.c dashboard.c dashboard3.c\
163                  short.c distress.c senddist.c defwin.c tools.c sound.c\
164                  docwin.c cflags.c beeplite.c feature.c reserved.c\
165                  string_util.c local.c censor.c cowmain.c
166
167INPUTOBJ        = input.obj redraw.obj
168MAINOBJ         = main.obj
169MAINSRC         = main.c
170
171RSASRC =
172RSAOBJ =
173
174WIN32_SRCS = winmain.c mswindow.c winsndlib.c
175WIN32_OBJS = winmain.obj mswindow.obj winsndlib.obj
176
177RANDOMOBJ = random.obj
178
179INCLUDES        = struct.h packets.h defs.h copyright.h bitmaps.h data.h\
180                  oldbitmaps.h tngbitmaps.h hullbitmaps.h rabbitbitmaps.h\
181                  sound.h audio.h litebitmaps.h
182
183all: netrek.exe
184
185cflags.c: mkcflags.exe config.h mkfilent.mak
186		mkcflags "$(cc) $(cflags)" "$(ARCH)"  > cflags.c
187		echo char cwho[]="$(CWHO)"; >> cflags.c
188
189mkcflags.exe: mkcflags.c patchlevel.h version.h config.h mkfilent.mak
190		$(compileandlink) $(cflags) $(DEFS) $(INCS) mkcflags.c
191
192
193OBJS = $(ROBJ) $(MAINOBJ) $(RSAOBJ) $(INPUTOBJ) $(WIN32_OBJS)
194$(RANDOMOBJ)
195
196.c.obj:
197        $(cc) $(cflags) $(ccompileonly) $(cdebug) $(DEFS) $(INCS) $<
198
199!IFNDEF MSVC
200RESOURCES = netrek.rc
201!ELSE
202RESOURCES = netrek.res
203$(RESOURCES): netrek.rc
204        rc netrek.rc
205!ENDIF
206
207netrek.mif: mkfilent.mak
208		@echo $(conlflags) $(ldebug) $(lout)netrek.exe > $@
209!IFDEF MSVC
210		@echo netrek.res >> $@
211!ENDIF
212		@echo $(GMPLIB) >> $@
213		for %i in ($(OBJS)) do echo %i >> $@
214
215netrek.exe:  $(OBJS) $(RESOURCES) warn.cur trek.cur main.ico
216netrek.mif
217		$(link) @netrek.mif
218		copy netrek.exe c:\games\netrek
219!IFNDEF MSVC
220        $(rc) netrek.rc netrek.exe
221!ENDIF
222