summaryrefslogtreecommitdiff
path: root/src/makefile.emx
blob: 214932dd5792543aac61c82d9d675a4794098329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File: Makefile.emx

# Purpose: Makefile support for "main-emx.c"

# Note: Use 'dmake -B -r -f makefile.emx' to compile (see "main-emx.c" for details).
#       Use 'dmake -B -r -f makefile.emx install' to install the executables
#       and the batch file used for multiple VIO windows in the parent directory.
#
#       Use 'dmake -B -r -f makefile.emx clean' to remove temporary files.
#
# Advanced targets (used only by developers):
#
#       'patches': If the original sources are located in "..\old\src",
#                  then a file "..\patches.txt" will be created which contains
#                  all changed files (diff -c). "..\exp\patches.uue" will 
#                  contain the same file gziped and uuencodes. "..\exp\files.uue"
#		   will contain the three emx-specific files tared, gziped and
#                  uuencoded. Needs 4OS2.
#
#       'export': The file "..\exp\$(EXPORT)" is created so that it 
#                 can directly be uploaded as an official distribution archive.
#		  Needs 4OS2.
#

VERSION         = 279v5
EXPORT          = angband-$(VERSION).os2.zip

CC		= gcc
AR		= ar
CFLAGS		= -MMD -O3 -DUSE_EMX -Zmt 
LFLAGS		= -lvideo 

# Uncomment this if you have nice installed
#NICE		= nice -i -n -30

###################################################################################

.KEEP_STATE:

default: all depends :-)

install: ..\angband.exe ..\aclient.exe ..\startwnd.cmd

clean:
	-+@ del angband.exe
	-+@ del aclient.exe
	-+@ del depends
	-+@ del _state.mk
	-+@ del *.a
	-+@ del *.d
	-+@ del *.o

patches:  ..\patches.txt ..\exp\patches.uue ..\exp\files.uue

export: ..\exp\$(EXPORT) 

####################################################################################
###   You don't have to change anything below.   ###################################
####################################################################################

OBJS = \
  z-util.o z-virt.o z-form.o z-rand.o z-term.o z-sock.o \
  variable.o tables.o util.o cave.o \
  object1.o object2.o traps.o monster1.o monster2.o monster3.o \
  xtra1.o xtra2.o spells1.o spells2.o \
  melee1.o melee2.o files.o cmovie.o \
  status.o randart.o gods.o modules.o \
  cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o cmd7.o \
  store.o birth.o loadsave.o notes.o squeltch.o \
  wizard1.o wizard2.o levels.o ghost.o plots.o \
  generate.o gen_maze.o gen_evol.o dungeon.o init1.o init2.o \
  bldg.o wild.o powers.o help.o

.c.o:
	$(NICE) $(CC) $(CFLAGS) -c $*.c

all .PHONY: angband.exe aclient.exe 
	+@echo. 
	+@echo Now type 
	+@echo. 
	+@echo       '$(MAKECMD) $(MFLAGS) $(MAKEFILE) install'
	+@echo. 
	+@echo to install Angband in the parent directory, and/or
	+@echo. 
	+@echo       '$(MAKECMD) $(MFLAGS) $(MAKEFILE) clean'
	+@echo. 
	+@echo to remove a bunch of temporary files used during compilation!
	+@echo You may want to remove the src subdirectory, now that you have
	+@echo working executables.
	+@echo. 

EXPFILES = angband.exe;aclient.exe;patches.txt;readme;startwnd.cmd

..\exp\$(EXPORT) .PHONY .IGNORE: install patches
# Needs 4OS2!
	+@ md ..\exp >& nul                          ^ \
		md ..\exp\tmpdir >& nul              ^ \
		cd ..\exp\tmpdir                     ^ \
		copy ...\$(EXPFILES) > nul           ^ \
		md lib                               ^ \
		copy ...\lib\ lib\ /s >& nul         ^ \
		del lib\save\player >& nul           ^ \
		zip -m -r $(EXPORT) * > nul          ^ \
		move $(EXPORT) ..                    ^ \
		cd ..                                ^ \
		del tmpdir /xsqy >& nul
	
PATCHFILES  = *.c *.h makefile* ..\lib\user\pref-emx.prf

# Needs 4OS2! 
..\patches.txt .PHONY .IGNORE:
	+@ echo These are the changes to the original source  > ..\patches.txt		^ \
	echo archive ($(VERSION)). You don't need to apply them >> ..\patches.txt	^ \
	echo if you can get the latest archive, which will >> ..\patches.txt		^ \
	echo have them applied already. >> ..\patches.txt				^ \
	echo. >> ..\patches.txt								^ \
	except (*~) for %a in ($(PATCHFILES))						  \
	do (diff -c ..\old\src\%a %a >> ..\patches.txt)

# Needs 4OS2!
..\exp\patches.uue: ..\patches.txt
	+@ md ..\exp >& nul                                         ^ \
	cd ..\exp                                                ^ \
	copy ..\patches.txt patches-$(VERSION).os2               ^ \
	gzip -f patches-$(VERSION).os2                           ^ \
	uuencode patches-$(VERSION).os2.gz >& nul                ^ \
	del patches-$(VERSION).os2.gz                            ^ \
	move patches-$(VERSION).os2.gz.uue patches.uue           

FILES  = main-emx.c makefile.emx ..\lib\user\pref-emx.prf 
FILESP = main-emx.c makefile.emx pref-emx.prf 

# Needs 4OS2!
..\exp\files.uue: $(FILES)
	+@ md ..\exp >& nul                                        ^ \
	cd ..\exp                                               ^ \
	for %a in ($(FILES)) copy ..\src\%a > nul               ^ \
	tar -cvf files.tar $(FILESP)                            ^ \
	del $(FILESP)						^ \
	gzip files.tar                                          ^ \
	uuencode files.tar.gz                                   ^ \
	del files.tar.gz >& nul                                 ^ \
	move files.tar.gz.uue files.uue                          

depends .IGNORE: $(OBJS)
	+ echo. > depends
	+ for %a in (*.d) type %a >> depends

..\angband.exe: angband.exe
	+ copy angband.exe ..
	emxbind -s ..\angband.exe

..\aclient.exe: aclient.exe
	+ copy aclient.exe ..
	emxbind -s ..\aclient.exe

EC=+@ echo 
ECF=>> ..\startwnd.cmd

..\startwnd.cmd: 
	$(EC) /* rexx, sir */						> ..\startwnd.cmd
	$(EC).								$(ECF)
	$(EC) call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'	$(ECF)
	$(EC) call SysLoadFuncs						$(ECF)
	$(EC).								$(ECF)
	$(EC) /* This file starts up Angband and up to seven other views. The */	$(ECF)
	$(EC) /* optional number behind the name sets the number of lines for */	$(ECF)
	$(EC) /* that screen.  Choose contents for each via the game options. */	$(ECF)
	$(EC).								$(ECF)
	$(EC) say 'starting up terminals...'				$(ECF)
	$(EC).								$(ECF)
	$(EC) '@start /b /win /n aclient Mirror 23'			$(ECF)
	$(EC) '@start /b /win /n aclient Recall 10'			$(ECF)
	$(EC) /*							$(ECF)
	$(EC) '@start /b /win /n aclient Choice'			$(ECF)
	$(EC) '@start /b /win /n aclient Term-4'			$(ECF)
	$(EC) '@start /b /win /n aclient Term-5'			$(ECF)
	$(EC) '@start /b /win /n aclient Term-6'			$(ECF)
	$(EC) '@start /b /win /n aclient Term-7'			$(ECF)
	$(EC) */							$(ECF)
	$(EC) call SysSleep(2)						$(ECF)
	$(EC) '@angband 'ARG(1)						$(ECF)
	$(EC) exit							$(ECF)

angband.exe: angband.a main.o main-emx.o main-epm.o
	$(CC) -o angband.exe main.o main-emx.o angband.a $(LFLAGS) 

angband.a: $(OBJS)
	$(AR) r angband.a $(OBJS)

aclient.exe: main-emx.c
	$(NICE) $(CC) $(CFLAGS) -Wall -D__EMX__CLIENT__ -o aclient.exe main-emx.c -lvideo

main-emx.o: main-emx.c
	$(NICE) $(CC) $(CFLAGS) -Wall -c main-emx.c -o main-emx.o

main-epm.o: main-emx.c
	$(NICE) $(CC) $(CFLAGS) -Wall -DEMXPM -c main-emx.c -o main-epm.o

# Forgive me :)
":-)":
	+@echo.

.INCLUDE .IGNORE: depends