forked from tsadok/sporkhack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcursmake.gcc
1357 lines (1134 loc) · 47.1 KB
/
cursmake.gcc
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SCCS Id: @(#)Makefile.gcc 3.4 $Date: 2003/11/16 04:50:57 $
# Copyright (c) NetHack PC Development Team 1993-2003
#
# NetHack 3.4.x Makefile for MinGW
#
# Win32 Compilers Tested:
# - MinGW 1.0 (gcc version 2.95.3-6) (Console NetHack only)
# - MinGW 2.0 (gcc version 3.2)
#
# If you don't have this compiler, you can get it at:
# http://www.mingw.org/
#
# This is used for building two versions of NetHack:
# A tty port utilizing the Win32 Console I/O subsystem, Console
# NetHack;
# A Win32 native port built on the Windows API, Graphical NetHack or
# NetHackW.
#
# In addition to your C compiler,
#
# if you want to change you will need a
# files with suffix workalike for
# .y yacc (such as bison)
# .l lex (such as flex)
#
#
# If you have any questions read the sys/winnt/Install.nt file included
# with the distribution.
#
# --
# Dion Nicolaas
#==============================================================================
# Graphical interface
# Set to Y for a graphical version
# Set to anything else (or undefine) for a tty version
GRAPHICAL = N
# Debug
# Set to Y for Debug support (to produce debug information)
# Set to anything else (or undefine) for a "release" version
# You can set your debug options below.
DEBUG = Y
cc = gcc
rc = windres
link = gcc
cflags = -mms-bitfields
lflags =
ifeq "$(DEBUG)" "Y"
cdebug = -g
linkdebug = -g
else
cdebug =
linkdebug =
endif
#
# Set the gamedir according to your preference.
# If not present prior to compilation it gets created.
ifeq "$(GRAPHICAL)" "Y"
# Game Name
GAME = NetHackW
else
# Game Name
GAME = NetHackC
endif
# Game directory
GAMEDIR = ../binary
#
# Source directories. Makedefs hardcodes these, don't change them.
#
# NetHack include files
INCL = ../include
# NetHack data files
DAT = ../dat
# NetHack documentation files
DOC = ../doc
# Utility source
UTIL = ../util
# Main source
SRC = ../src
# Shared system files
SSYS = ../sys/share
# NT Win32 specific files
NTSYS = ../sys/winnt
# window port files (tty)
#TTY = ../win/tty
TTY = ../win/curses
# window port files (Win32)
WIN32 = ../win/win32
# Tile support files
WSHR = ../win/share
#
# Object directory.
#
OBJ = o
#
#==========================================
# Exe File Info.
#==========================================
# Yacc/Lex ... if you got 'em.
#
# If you have yacc and lex programs (or work-alike such as bison
# and flex), comment out the upper two macros and uncomment
# the lower two.
#
DO_YACC = YACC_MSG
DO_LEX = LEX_MSG
#DO_YACC = YACC_ACT
#DO_LEX = LEX_ACT
# - Specify your yacc and lex programs (or work-alikes) here.
#YACC = bison -y
YACC = byacc
#YACC = yacc
#LEX = lex
LEX = flex
#
# - Specify your flex skeleton file (if needed).
#
FLEXSKEL =
#FLEXSKEL = -S../tools/flex.ske
YTABC = y_tab.c
YTABH = y_tab.h
LEXYYC = lexyy.c
#
# Optional high-quality BSD random number generation routines
# (see pcconf.h). Set to nothing if not used.
#
RANDOM = $(OBJ)/random.o
#RANDOM =
#===============================================
#======= End of Modification Section ===========
#===============================================
################################################
# #
# Nothing below here should have to be changed.#
# #
################################################
ifeq "$(GRAPHICAL)" "Y"
WINPORT = $(O)tile.o $(O)mhaskyn.o $(O)mhdlg.o \
$(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
$(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \
$(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o
WINPFLAG = -DTILES -DMSWIN_GRAPHICS -D_WIN32_IE=0x0400
NHRES = $(O)winres.o
WINPINC = -I$(WIN32)
WINPHDR = $(WIN32)/mhaskyn.h $(WIN32)/mhdlg.h $(WIN32)/mhfont.h \
$(WIN32)/mhinput.h $(WIN32)/mhmain.h $(WIN32)/mhmap.h \
$(WIN32)/mhmenu.h $(WIN32)/mhmsg.h $(WIN32)/mhmsgwnd.h \
$(WIN32)/mhrip.h $(WIN32)/mhstatus.h \
$(WIN32)/mhtext.h $(WIN32)/resource.h $(WIN32)/winMS.h
WINPLIBS = -lcomctl32 -lwinmm
else
WINPORT = $(O)nttty.o
#WINPFLAG= -DWIN32CON
WINPHDR =
NHRES = $(O)console.o
WINPINC =
#WINPLIBS = ../lib/pdcurses.a -lwinmm
WINPLIBS = ../lib/libpdcurses.a ../lib/libSDL.a -lwinmm
endif
TILEUTIL16 = $(UTIL)/tile2bmp.exe
TILEBMP16 = $(SRC)/tiles.bmp
TILEUTIL32 = $(UTIL)/til2bm32.exe
TILEBMP32 = $(SRC)/tiles32.bmp
SOUND = $(OBJ)/ntsound.o
#SOUND =
# To store all the level files,
# help files, etc. in a single library file.
# USE_DLB = Y is left uncommented
USE_DLB = Y
ifeq "$(USE_DLB)" "Y"
DLBFLG = -DDLB
else
DLBFLG =
endif
#==========================================
# Setting up the compiler and linker
# macros. All builds include the base ones.
#==========================================
CFLAGSBASE = -c $(cflags) -I$(INCL) $(WINPINC) $(cdebug)
LFLAGSBASEC = $(linkdebug) -mwindows
LFLAGSBASEG = $(linkdebug) -mwindows
#==========================================
# Util builds
#==========================================
CFLAGSU = $(CFLAGSBASE) $(WINPFLAG)
LFLAGSU = $(LFLAGSBASEC)
#==========================================
# - Game build
#==========================================
CFLAGS = $(CFLAGSBASE) $(WINPFLAG) $(DLBFLG)
lflags = $(LFLAGSBASE)
ifeq "$(GRAPHICAL)" "Y"
lflags = $(LFLAGSBASEG)
else
lflags = $(LFLAGSBASEC)
endif
GAMEFILE = $(GAMEDIR)/$(GAME).exe # whole thing
ifeq "$(USE_DLB)" "Y"
DLB = nhdat
else
DLB =
endif
#==========================================
#================ RULES ==================
#==========================================
.SUFFIXES: .exe .o .til .uu .c .y .l
#==========================================
# Rules for files in src
#==========================================
$(OBJ)/%.o : /%.c
$(cc) $(CFLAGS) -o$@ $<
$(OBJ)/%.o : $(SRC)/%.c
$(cc) $(CFLAGS) -o$@ $<
#==========================================
# Rules for files in sys/share
#==========================================
$(OBJ)/%.o : $(SSYS)/%.c
$(cc) $(CFLAGS) -o$@ $<
#==========================================
# Rules for files in sys/winnt
#==========================================
$(OBJ)/%.o : $(NTSYS)/%.c
$(cc) $(CFLAGS) -o$@ $<
$(INCL)/%.h : $(NTSYS)/%.h
@copy $< $@
#==========================================
# Rules for files in util
#==========================================
$(OBJ)/%.o : $(UTIL)/%.c
$(cc) $(CFLAGSU) -o$@ $<
#==========================================
# Rules for files in win/share
#==========================================
$(OBJ)/%.o : $(WSHR)/%.c
$(cc) $(CFLAGS) -o$@ $<
$(INCL)/%.h : $(WSHR)/%.h
@copy $< $@
#{$(WSHR)}.txt{$(DAT)}.txt:
# @copy $< $@
#==========================================
# Rules for files in win/tty
#==========================================
$(OBJ)/%.o : $(TTY)/%.c
$(cc) $(CFLAGS) -o$@ $<
#==========================================
# Rules for files in win/win32
#==========================================
$(OBJ)/%.o : $(WIN32)/%.c
$(cc) $(CFLAGS) -o$@ $<
#==========================================
#================ MACROS ==================
#==========================================
# This section creates shorthand macros for many objects
# referenced later on in the Makefile.
#
DEFFILE = $(NTSYS)/$(GAME).def
#
# Shorten up the location for some files
#
O = $(OBJ)/
U = $(UTIL)/
#
# Utility Objects.
#
MAKESRC = $(U)makedefs.c
SPLEVSRC = $(U)lev_yacc.c $(U)lev_$(LEX).c $(U)lev_main.c $(U)panic.c
DGNCOMPSRC = $(U)dgn_yacc.c $(U)dgn_$(LEX).c $(U)dgn_main.c
MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o \
$(O)alloc.o $(O)decl.o $(O)drawing.o \
$(O)monst.o $(O)objects.o $(O)panic.o
DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o \
$(O)alloc.o $(O)panic.o
RECOVOBJS = $(O)recover.o
TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt
#
# These are not invoked during a normal game build in 3.4
#
TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \
$(O)decl.o $(O)monst.o $(O)objects.o
TEXT_IO32 = $(O)tilete32.o $(O)tiletx32.o $(O)drawing.o \
$(O)decl.o $(O)monst.o $(O)objects.o
GIFREADERS = $(O)gifread.o $(O)alloc.o $(O)panic.o
GIFREADERS32 = $(O)gifrd32.o $(O)alloc.o $(O)panic.o
PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
#
# Object files for the game itself.
#
VOBJ01 = $(O)allmain.o $(O)alloc.o $(O)apply.o $(O)artifact.o
VOBJ02 = $(O)attrib.o $(O)ball.o $(O)bones.o $(O)botl.o
VOBJ03 = $(O)cmd.o $(O)dbridge.o $(O)decl.o $(O)detect.o
VOBJ04 = $(O)dig.o $(O)display.o $(O)do.o $(O)do_name.o
VOBJ05 = $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o
VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o
VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o
VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o
VOBJ11 = $(O)mhitm.o $(O)mhitu.o $(O)minion.o $(O)mklev.o
VOBJ12 = $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o $(O)mkroom.o
VOBJ13 = $(O)mon.o $(O)mondata.o $(O)monmove.o $(O)monst.o
VOBJ14 = $(O)monstr.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o
VOBJ15 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o
VOBJ16 = $(O)options.o $(O)pager.o $(O)pickup.o $(O)pline.o
VOBJ17 = $(O)polyself.o $(O)potion.o $(O)pray.o $(O)priest.o
VOBJ18 = $(O)quest.o $(O)questpgr.o $(RANDOM) $(O)read.o
VOBJ19 = $(O)rect.o $(O)region.o $(O)restore.o $(O)rip.o
VOBJ20 = $(O)rnd.o $(O)role.o $(O)rumors.o $(O)save.o
VOBJ21 = $(O)shk.o $(O)shknam.o $(O)sit.o $(O)sounds.o
VOBJ22 = $(O)sp_lev.o $(O)spell.o $(O)steal.o $(O)steed.o
VOBJ23 = $(O)teleport.o $(O)timeout.o $(O)topten.o $(O)track.o
VOBJ24 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o
VOBJ25 = $(O)vis_tab.o $(O)vision.o $(O)weapon.o $(O)were.o
VOBJ26 = $(O)wield.o $(O)windows.o $(O)wizard.o $(O)worm.o
VOBJ27 = $(O)worn.o $(O)write.o $(O)zap.o
DLBOBJ = $(O)dlb.o
#TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o
TTYOBJ = $(O)cursmain.o $(O)curswins.o $(O)cursmisc.o $(O)cursdial.o \
$(O)cursstat.o $(O)cursinit.o $(O)cursmesg.o
SOBJ = $(O)winnt.o $(O)pcsys.o $(O)pcunix.o \
$(SOUND) $(O)pcmain.o $(O)mapimail.o $(O)nhlan.o
OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \
$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
$(VOBJ26) $(VOBJ27)
WINPOBJ = $(WINPORT)
VVOBJ = $(O)version.o
ALLOBJ = $(WINPOBJ) $(SOBJ) $(DLBOBJ) $(TTYOBJ) $(WOBJ) $(OBJS) $(VVOBJ)
ifeq "$(GRAPHICAL)" "Y"
OPTIONS_FILE = $(DAT)/guioptions
else
OPTIONS_FILE = $(DAT)/ttyoptions
endif
#==========================================
# Header file macros
#==========================================
CONFIG_H = $(INCL)/config.h $(INCL)/config1.h $(INCL)/tradstdc.h \
$(INCL)/global.h $(INCL)/coord.h $(INCL)/vmsconf.h \
$(INCL)/system.h $(INCL)/unixconf.h $(INCL)/os2conf.h \
$(INCL)/micro.h $(INCL)/pcconf.h $(INCL)/tosconf.h \
$(INCL)/amiconf.h $(INCL)/macconf.h $(INCL)/beconf.h \
$(INCL)/ntconf.h $(INCL)/nhlan.h
HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/align.h \
$(INCL)/dungeon.h $(INCL)/monsym.h $(INCL)/mkroom.h \
$(INCL)/objclass.h $(INCL)/youprop.h $(INCL)/prop.h \
$(INCL)/permonst.h $(INCL)/monattk.h \
$(INCL)/monflag.h $(INCL)/mondata.h $(INCL)/pm.h \
$(INCL)/wintype.h $(INCL)/decl.h $(INCL)/quest.h \
$(INCL)/spell.h $(INCL)/color.h $(INCL)/obj.h \
$(INCL)/you.h $(INCL)/attrib.h $(INCL)/monst.h \
$(INCL)/skills.h $(INCL)/onames.h $(INCL)/timeout.h \
$(INCL)/trap.h $(INCL)/flag.h $(INCL)/rm.h \
$(INCL)/vision.h $(INCL)/display.h $(INCL)/engrave.h \
$(INCL)/rect.h $(INCL)/region.h $(INCL)/winprocs.h \
$(INCL)/wintty.h $(INCL)/trampoli.h
LEV_H = $(INCL)/lev.h
DGN_FILE_H = $(INCL)/dgn_file.h
LEV_COMP_H = $(INCL)/lev_comp.h
SP_LEV_H = $(INCL)/sp_lev.h
TILE_H = ../win/share/tile.h
#==========================================
# Miscellaneous
#==========================================
DATABASE = $(DAT)/data.base
#
# The name of the game.
#
GAMEFILE = $(GAMEDIR)/$(GAME).exe
#==========================================
#=============== TARGETS ==================
#==========================================
# Since DOS doesn't allow / as path separator, and GCC doesn't allow \ as
# path separator, we must change all pathnames when performing DOS commands.
# This is done by blindly applying $(subst /,\, ...) on every command.
# Where any command contain / for another reason (switch char, or echoing
# comment lines to lev/dungeon files) a little more care is taken.
#
# The default make target (so just typing 'nmake' is useful).
#
default : $(GAMEFILE)
#
# The main target.
#
$(GAME) : $(O)obj.tag $(O)utility.tag graphicschk $(GAMEFILE)
@echo $(GAME) is up to date.
#
# Everything
#
all : install
install: graphicschk $(GAME) $(O)install.tag
@echo Done.
$(O)install.tag: $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \
$(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag $(DLB)
ifeq "$(USE_DLB)" "Y"
$(subst /,\,copy nhdat $(GAMEDIR))
$(subst /,\,copy $(DAT)/license $(GAMEDIR))
$(subst /,\,copy $(DAT)/opthelp $(GAMEDIR))
else
$(subst /,\,copy $(DAT)/*. $(GAMEDIR))
$(subst /,\,copy $(DAT)/*.dat $(GAMEDIR))
$(subst /,\,copy $(DAT)/*.lev $(GAMEDIR))
$(subst /,\,if exist $(GAMEDIR)/makefile del $(GAMEDIR)/makefile)
endif
$(subst /,\,if exist $(DOC)/guidebook.txt copy $(DOC)/guidebook.txt $(GAMEDIR)/Guidebook.txt)
$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)/NetHack.txt)
$(subst /,\,copy $(NTSYS)/defaults.nh $(GAMEDIR)/defaults.nh)
$(subst /,\,echo install done > $@)
# copy $(NTSYS)/winnt.hlp $(GAMEDIR)
recover: $(U)recover.exe
$(subst /,\,if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR))
$(subst /,\,if exist $(DOC)/recover.txt copy $(DOC)/recover.txt $(GAMEDIR)/recover.txt)
$(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \
$(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \
$(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \
$(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \
$(DAT)/caveman.des $(DAT)/healer.des $(DAT)/knight.des \
$(DAT)/monk.des $(DAT)/priest.des $(DAT)/ranger.des \
$(DAT)/rogue.des $(DAT)/samurai.des $(DAT)/sokoban.des \
$(DAT)/tourist.des $(DAT)/valkyrie.des $(DAT)/wizard.des
$(subst /,\,$(U)lev_comp $(DAT)/bigroom.des)
$(subst /,\,$(U)lev_comp $(DAT)/castle.des)
$(subst /,\,$(U)lev_comp $(DAT)/endgame.des)
$(subst /,\,$(U)lev_comp $(DAT)/gehennom.des)
$(subst /,\,$(U)lev_comp $(DAT)/knox.des)
$(subst /,\,$(U)lev_comp $(DAT)/mines.des)
$(subst /,\,$(U)lev_comp $(DAT)/medusa.des)
$(subst /,\,$(U)lev_comp $(DAT)/oracle.des)
$(subst /,\,$(U)lev_comp $(DAT)/sokoban.des)
$(subst /,\,$(U)lev_comp $(DAT)/tower.des)
$(subst /,\,$(U)lev_comp $(DAT)/yendor.des)
$(subst /,\,$(U)lev_comp $(DAT)/arch.des)
$(subst /,\,$(U)lev_comp $(DAT)/barb.des)
$(subst /,\,$(U)lev_comp $(DAT)/caveman.des)
$(subst /,\,$(U)lev_comp $(DAT)/healer.des)
$(subst /,\,$(U)lev_comp $(DAT)/knight.des)
$(subst /,\,$(U)lev_comp $(DAT)/monk.des)
$(subst /,\,$(U)lev_comp $(DAT)/priest.des)
$(subst /,\,$(U)lev_comp $(DAT)/ranger.des)
$(subst /,\,$(U)lev_comp $(DAT)/rogue.des)
$(subst /,\,$(U)lev_comp $(DAT)/samurai.des)
$(subst /,\,$(U)lev_comp $(DAT)/tourist.des)
$(subst /,\,$(U)lev_comp $(DAT)/valkyrie.des)
$(subst /,\,$(U)lev_comp $(DAT)/wizard.des)
$(subst /,\,copy *.lev $(DAT))
$(subst /,\,del *.lev)
$(subst /,\,echo sp_levs done > $(O)sp_lev.tag)
$(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \
$(SRC)/monstr.c $(SRC)/vis_tab.c $(U)lev_comp.exe $(INCL)/vis_tab.h \
$(U)dgn_comp.exe $(TILEUTIL16)
$(subst /,\,@echo utilities made >$@)
@echo utilities made.
tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
@echo Optional tile development utilities are up to date.
ifeq "$(GRAPHICAL)" "Y"
$(NHRES): $(TILEBMP16) $(WIN32)/winhack.rc $(WIN32)/mnsel.bmp \
$(WIN32)/mnselcnt.bmp $(WIN32)/mnunsel.bmp \
$(WIN32)/petmark.bmp $(WIN32)/NetHack.ico $(WIN32)/rip.bmp \
$(WIN32)/splash.bmp
@$(rc) -o$@ --include-dir $(WIN32) -i $(WIN32)/winhack.rc
else
$(NHRES): $(NTSYS)/console.rc $(NTSYS)/NetHack.ico
@$(rc) -o$@ --include-dir $(NTSYS) -i $(NTSYS)/console.rc
endif
#==========================================
# The main target.
#==========================================
$(O)gamedir.tag:
$(subst /,\,@if not exist $(GAMEDIR)/*.* echo creating directory $(GAMEDIR))
$(subst /,\,@if not exist $(GAMEDIR)/*.* mkdir $(GAMEDIR))
$(subst /,\,@echo directory created > $@)
ifeq "$(GRAPHICAL)" "Y"
$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag
else
#$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag \
# $(GAMEDIR)/nhdefkey.dll $(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll
$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag
endif
@echo Linking....
$(link) $(lflags) -o$@ $(ALLOBJ) $(NHRES) $(WINPLIBS)
$(subst /,\,@if exist $(O)install.tag del $(O)install.tag)
$(O)nhdefkey.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhdefkey.c
$(GAMEDIR)/nhdefkey.dll : $(O)nhdefkey.o $(O)gamedir.tag
@echo Linking $@
$(cc) -shared -Wl,--export-all-symbols \
-Wl,--add-stdcall-alias -o $@ $<
$(O)nh340key.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nh340key.c
$(GAMEDIR)/nh340key.dll : $(O)nh340key.o $(O)gamedir.tag
@echo Linking $@
$(cc) -shared -Wl,--export-all-symbols \
-Wl,--add-stdcall-alias -o $@ $<
$(O)nhraykey.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhraykey.c
$(GAMEDIR)/nhraykey.dll : $(O)nhraykey.o $(O)gamedir.tag
@echo Linking $@
$(cc) -shared -Wl,--export-all-symbols \
-Wl,--add-stdcall-alias -o $@ $<
$(GAME)_.ico : $(NTSYS)/$(GAME).ico
$(subst /,\,@copy $(NTSYS)/$(GAME).ico $@)
#==========================================
# Create directory for holding object files
#==========================================
graphicschk:
ifeq "$(GRAPHICAL)" "Y"
@echo ----
@echo NOTE: This build will include tile support.
@echo ----
endif
$(subst /,\,@echo graphicschk > graphicschk)
#
# Secondary Targets.
#
#==========================================
# Makedefs Stuff
#==========================================
$(U)makedefs.exe: $(MAKEOBJS)
@$(link) $(LFLAGSU) -o$@ $(MAKEOBJS)
$(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \
$(INCL)/objclass.h $(INCL)/monsym.h $(INCL)/qtext.h \
$(INCL)/patchlevel.h $(U)makedefs.c $(O)obj.tag
$(cc) $(CFLAGSU) -o$@ $(U)makedefs.c
#
# date.h should be remade every time any of the source or include
# files is modified.
#
$(INCL)/date.h $(OPTIONS_FILE): $(U)makedefs.exe
$(subst /,\,$(U)makedefs -v)
#$(OPTIONS_FILE): $(U)makedefs.exe
# $(subst /,\,$(U)makedefs -v)
$(INCL)/onames.h : $(U)makedefs.exe
$(subst /,\,$(U)makedefs -o)
$(INCL)/pm.h : $(U)makedefs.exe
$(subst /,\,$(U)makedefs -p)
#$(INCL)/trap.h : $(U)makedefs.exe
# $(U)makedefs -t
$(SRC)/monstr.c: $(U)makedefs.exe
$(subst /,\,$(U)makedefs -m)
$(INCL)/vis_tab.h: $(U)makedefs.exe
$(subst /,\,$(U)makedefs -z)
$(SRC)/vis_tab.c: $(U)makedefs.exe
$(subst /,\,$(U)makedefs -z)
#==========================================
# uudecode utility and uuencoded targets
#==========================================
$(U)uudecode.exe: $(O)uudecode.o
@$(link) $(LFLAGSU) -o$@ $(O)uudecode.o
$(O)uudecode.o: $(SSYS)/uudecode.c
$(NTSYS)/NetHack.ico : $(U)uudecode.exe $(NTSYS)/nhico.uu
$(subst /,\,$(U)uudecode.exe $(NTSYS)/nhico.uu)
$(subst /,\,copy NetHack.ico $@)
del NetHack.ico
$(WIN32)/NetHack.ico : $(NTSYS)/NetHack.ico
$(subst /,\,copy $< $@)
$(WIN32)/mnsel.bmp: $(U)uudecode.exe $(WIN32)/mnsel.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/mnsel.uu)
$(subst /,\,copy mnsel.bmp $@)
del mnsel.bmp
$(WIN32)/mnselcnt.bmp: $(U)uudecode.exe $(WIN32)/mnselcnt.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/mnselcnt.uu)
$(subst /,\,copy mnselcnt.bmp $@)
del mnselcnt.bmp
$(WIN32)/mnunsel.bmp: $(U)uudecode.exe $(WIN32)/mnunsel.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/mnunsel.uu)
$(subst /,\,copy mnunsel.bmp $@)
del mnunsel.bmp
$(WIN32)/petmark.bmp: $(U)uudecode.exe $(WIN32)/petmark.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/petmark.uu)
$(subst /,\,copy petmark.bmp $@)
del petmark.bmp
$(WIN32)/rip.bmp: $(U)uudecode.exe $(WIN32)/rip.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/rip.uu)
$(subst /,\,copy rip.bmp $@)
del rip.bmp
$(WIN32)/splash.bmp: $(U)uudecode.exe $(WIN32)/splash.uu
$(subst /,\,$(U)uudecode.exe $(WIN32)/splash.uu)
$(subst /,\,copy splash.bmp $@)
del splash.bmp
#==========================================
# Level Compiler Stuff
#==========================================
LEVCFLAGS=$(cflags) -c -DWIN32 -D_WIN32 -I../include $(cdebug) -DDLB
$(U)lev_comp.exe: $(SPLEVOBJS)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(SPLEVOBJS)
$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)/lev_comp.h $(U)lev_yacc.c
$(cc) $(LEVCFLAGS) -o$@ $(U)lev_yacc.c
$(O)lev_$(LEX).o: $(HACK_H) $(INCL)/lev_comp.h $(SP_LEV_H) \
$(U)lev_$(LEX).c
$(cc) $(LEVCFLAGS) -o$@ $(U)lev_$(LEX).c
$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H)
$(cc) $(LEVCFLAGS) -o$@ $(U)lev_main.c
$(U)lev_yacc.c $(INCL)/lev_comp.h : $(U)lev_comp.y
ifeq "$(DO_YACC)" "YACC_ACT"
$(subst /,\,$(YACC) -d $(U)lev_comp.y)
$(subst /,\,copy $(YTABC) $(U)lev_yacc.c)
$(subst /,\,copy $(YTABH) $(INCL)/lev_comp.h)
$(subst /,\,@del $(YTABC))
$(subst /,\,@del $(YTABH))
else
@echo $(U)lev_comp.y has changed.
@echo To update $(U)lev_yacc.c and $(INCL)/lev_comp.h run $(YACC).
@echo ---
@echo For now, we will copy the prebuilt lev_yacc.c and
@echo lev_comp.h from $(SSYS) into $(UTIL) and use them.
$(subst /,\,@copy $(SSYS)/lev_yacc.c $(U)lev_yacc.c >nul)
$(subst /,\,@copy $(SSYS)/lev_comp.h $(INCL)/lev_comp.h >nul)
$(subst /,\,echo.>>$(U)lev_yacc.c)
$(subst /,\,echo.>>$(INCL)/lev_comp.h)
endif
$(U)lev_$(LEX).c: $(U)lev_comp.l
ifeq "$(DO_LEX)" "LEX_ACT"
$(subst /,\,$(LEX) $(FLEXSKEL) $(U)lev_comp.l)
$(subst /,\,copy $(LEXYYC) $@)
$(subst /,\,@del $(LEXYYC))
else
@echo $(U)lev_comp.l has changed. To update $@ run $(LEX).
@echo ---
@echo For now, we will copy the prebuilt lev_lex.c
@echo from $(SSYS) into $(UTIL) and use it.
$(subst /,\,@copy $(SSYS)/lev_lex.c $@ >nul)
$(subst /,\,echo.>>$@)
endif
#==========================================
# Dungeon Compiler Stuff
#==========================================
$(U)dgn_comp.exe: $(DGNCOMPOBJS)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(DGNCOMPOBJS)
$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)/dgn_comp.h $(U)dgn_yacc.c
$(cc) $(LEVCFLAGS) -o$@ $(U)dgn_yacc.c
$(O)dgn_$(LEX).o: $(HACK_H) $(DGN_FILE_H) $(INCL)/dgn_comp.h \
$(U)dgn_$(LEX).c
$(cc) $(LEVCFLAGS) -o$@ $(U)dgn_$(LEX).c
$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c
$(cc) $(LEVCFLAGS) -o$@ $(U)dgn_main.c
$(U)dgn_yacc.c $(INCL)/dgn_comp.h : $(U)dgn_comp.y
ifeq "$(DO_YACC)" "YACC_ACT"
$(subst /,\,$(YACC) -d $(U)dgn_comp.y)
$(subst /,\,copy $(YTABC) $(U)dgn_yacc.c)
$(subst /,\,copy $(YTABH) $(INCL)/dgn_comp.h)
$(subst /,\,@del $(YTABC))
$(subst /,\,@del $(YTABH))
else
@echo $(U)dgn_comp.y has changed. To update dgn_yacc.c and
@echo $(INCL)/dgn_comp.h run $(YACC).
@echo ---
@echo For now, we will copy the prebuilt $(U)dgn_yacc.c and
@echo dgn_comp.h from $(SSYS) into $(UTIL) and use them.
$(subst /,\,@copy $(SSYS)/dgn_yacc.c $(U)dgn_yacc.c >nul)
$(subst /,\,@copy $(SSYS)/dgn_comp.h $(INCL)/dgn_comp.h >nul)
$(subst /,\,echo.>>$(U)dgn_yacc.c)
$(subst /,\,echo.>>$(INCL)/dgn_comp.h)
endif
$(U)dgn_$(LEX).c: $(U)dgn_comp.l
ifeq "$(DO_LEX)" "LEX_ACT"
$(subst /,\,$(LEX) $(FLEXSKEL) $(U)dgn_comp.l)
$(subst /,\,copy $(LEXYYC) $@)
$(subst /,\,@del $(LEXYYC))
else
@echo $(U)dgn_comp.l has changed. To update $@ run $(LEX).
@echo ---
@echo For now, we will copy the prebuilt dgn_lex.c
@echo from $(SSYS) into $(UTIL) and use it.
$(subst /,\,@copy $(SSYS)/dgn_lex.c $@ >nul)
$(subst /,\,echo.>>$@)
endif
#==========================================
# Create directory for holding object files
#==========================================
$(O)obj.tag:
$(subst /,\,@if not exist $(OBJ)/*.* echo creating directory $(OBJ))
$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ))
$(subst /,\,@echo directory created > $@)
#==========================================
#=========== SECONDARY TARGETS ============
#==========================================
#===========================================
# Header files NOT distributed in ../include
#===========================================
$(INCL)/win32api.h: $(NTSYS)/win32api.h
$(subst /,\,copy $(NTSYS)/win32api.h $@)
#==========================================
# DLB utility and nhdat file creation
#==========================================
$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o
@$(link) $(LFLAGSU) -o$@ $(O)dlb_main.o $(O)dlb.o $(O)alloc.o $(O)panic.o
$(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)/dlb.h
$(cc) $(CFLAGS) -o$@ $(SRC)/dlb.c
$(O)dlb_main.o: $(UTIL)/dlb_main.c $(INCL)/config.h $(INCL)/dlb.h
$(cc) $(CFLAGS) -o$@ $(UTIL)/dlb_main.c
$(DAT)/porthelp: $(NTSYS)/porthelp
$(subst /,\,@copy $(NTSYS)/porthelp $@ >nul)
nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \
$(DAT)/quest.dat $(DAT)/rumors $(DAT)/help $(DAT)/hh $(DAT)/cmdhelp \
$(DAT)/history $(DAT)/opthelp $(DAT)/wizhelp $(DAT)/dungeon \
$(DAT)/porthelp $(DAT)/license $(O)sp_lev.tag
$(subst /,\,echo data >$(DAT)/dlb.lst)
$(subst /,\,echo oracles >>$(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/options echo options >>$(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/ttyoptions echo ttyoptions >>$(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/guioptions echo guioptions >>$(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/porthelp echo porthelp >>$(DAT)/dlb.lst)
$(subst /,\,echo quest.dat >>$(DAT)/dlb.lst)
$(subst /,\,echo rumors >>$(DAT)/dlb.lst)
$(subst /,\,echo help >>$(DAT)/dlb.lst)
$(subst /,\,echo hh >>$(DAT)/dlb.lst)
$(subst /,\,echo cmdhelp >>$(DAT)/dlb.lst)
$(subst /,\,echo history >>$(DAT)/dlb.lst)
$(subst /,\,echo opthelp >>$(DAT)/dlb.lst)
$(subst /,\,echo wizhelp >>$(DAT)/dlb.lst)
$(subst /,\,echo dungeon >>$(DAT)/dlb.lst)
$(subst /,\,echo license >>$(DAT)/dlb.lst)
dir /l /b /-p $(subst /,\,$(DAT)/*.lev >>$(DAT)/dlb.lst)
$(subst /,\,$(U)dlb_main CcIf $(DAT) dlb.lst $(SRC)/nhdat)
#==========================================
# Recover Utility
#==========================================
$(U)recover.exe: $(RECOVOBJS)
$(link) $(LFLAGSU) -o$@ $(RECOVOBJS)
$(O)recover.o: $(CONFIG_H) $(U)recover.c $(INCL)/win32api.h
$(cc) $(CFLAGSU) -o$@ $(U)recover.c
#==========================================
# Tile Mapping
#==========================================
$(SRC)/tile.c: $(U)tilemap.exe
@echo A new $@ has been created
@$(U)tilemap
$(U)tilemap.exe: $(O)tilemap.o
@$(link) $(LFLAGSU) -o$@ $(O)tilemap.o
$(O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H)
$(cc) $(CFLAGSU) -o$@ $(WSHR)/tilemap.c
$(O)tiletx32.o: $(WSHR)/tilemap.c $(HACK_H)
$(cc) $(CFLAGS) -DTILETEXT -DTILE_X=32 -DTILE_Y=32 -o$@ $(WSHR)/tilemap.c
$(O)tiletxt.o: $(WSHR)/tilemap.c $(HACK_H)
$(cc) $(CFLAGS) -DTILETEXT -o$@ $(WSHR)/tilemap.c
$(O)gifread.o: $(WSHR)/gifread.c $(CONFIG_H) $(TILE_H)
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(WSHR)/gifread.c
$(O)gifrd32.o: $(WSHR)/gifread.c $(CONFIG_H) $(TILE_H)
$(cc) $(CFLAGS) -I$(WSHR) -DTILE_X=32 -DTILE_Y=32 -o$@ $(WSHR)/gifread.c
$(O)ppmwrite.o: $(WSHR)/ppmwrite.c $(CONFIG_H) $(TILE_H)
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(WSHR)/ppmwrite.c
$(O)tiletext.o: $(WSHR)/tiletext.c $(CONFIG_H) $(TILE_H)
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(WSHR)/tiletext.c
$(O)tilete32.o: $(WSHR)/tiletext.c $(CONFIG_H) $(TILE_H)
$(cc) $(CFLAGS) -I$(WSHR) -DTILE_X=32 -DTILE_Y=32 -o$@ $(WSHR)/tiletext.c
#==========================================
# Optional Tile Utilities
#==========================================
$(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(GIFREADERS) $(TEXT_IO)
$(U)gif2tx32.exe: $(GIFREADERS32) $(TEXT_IO32)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(GIFREADERS32) $(TEXT_IO32)
$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(PPMWRITERS) $(TEXT_IO)
ifeq "$(GRAPHICAL)" "Y"
$(TILEBMP16): $(TILEUTIL16) $(TILEFILES)
@echo Creating 16x16 binary tile files (this may take some time)
$(subst /,\,@$(U)tile2bmp $(TILEBMP16))
#$(TILEBMP32): $(TILEUTIL32) $(TILEFILES32)
# @echo Creating 32x32 binary tile files (this may take some time)
# $(subst /,\,@$(U)til2bm32 $(TILEBMP32))
else
$(TILEBMP16):
$(TILEBMP32):
endif
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(O)tile2bmp.o $(TEXT_IO)
$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
@echo Linking $@...
@$(link) $(LFLAGSU) -o$@ $(O)til2bm32.o $(TEXT_IO32)
$(O)tile2bmp.o: $(WSHR)/tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)/win32api.h
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c
$(O)til2bm32.o: $(WSHR)/til2bm32.c $(HACK_H) $(TILE_H) $(INCL)/win32api.h
$(cc) $(CFLAGS) -I$(WSHR) -DTILE_X=32 -DTILE_Y=32 -o$@ $(WSHR)/til2bm32.c
#==========================================
# Housekeeping
#==========================================
spotless: clean
$(subst /,\,if exist graphicschk del graphicschk)
$(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h)
$(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h)
$(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h)
$(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h)
$(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c)
$(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c)