1# $NHDT-Date: 1524689255 2018/04/25 20:47:35 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $
2# Copyright (c) 2018 by Michael Allison
3# NetHack may be freely redistributed.  See license for details.
4
5# Set all of these or none of them.
6#
7# bison and flex are the ones found in GnuWin32, which
8# is probably the easiest set of these tools to find
9# on Windows.
10#
11#YACC    = bison.exe -y
12#LEX     = flex.exe
13#YTABC   = y.tab.c
14#YTABH   = y.tab.h
15#LEXYYC  = lex.yy.c
16
17
18default: all
19
20all: tools ..\util\dgn_yacc.c ..\util\dgn_lex.c
21
22rebuild: clean all
23
24clean:
25	-del ..\util\dgn_lex.c
26	-del ..\util\dgn_yacc.c
27	-del ..\include\dgn_comp.h
28
29tools:
30!IFDEF YACC
31	@echo Yacc-alike set to $(YACC)
32	@echo YTABC set to $(YTABC)
33	@echo YTABH set to $(YTABH)
34!ENDIF
35
36!IFDEF LEX
37	@echo Lex-alike set to $(LEX)
38	@echo LEXYYC set to $(LEXYYC)
39!ENDIF
40
41
42#==========================================
43# Dungeon Compiler Stuff
44#==========================================
45
46..\include\dgn_comp.h : ..\util\dgn_comp.y
47!IF "$(YACC)"==""
48	   @echo Using pre-built dgn_comp.h
49	   chdir ..\include
50	   copy /y ..\sys\share\dgn_comp.h
51	   copy /b dgn_comp.h+,,
52	   chdir ..\src
53!ELSE
54	   chdir ..\util
55	   $(YACC) -d dgn_comp.y
56	   copy $(YTABC) $@
57	   copy $(YTABH) ..\include\dgn_comp.h
58	   @del $(YTABC)
59	   @del $(YTABH)
60	   chdir ..\build
61!ENDIF
62
63..\util\dgn_yacc.c : ..\util\dgn_comp.y
64!IF "$(YACC)"==""
65	   @echo Using pre-built dgn_yacc.c
66	   chdir ..\util
67	   copy /y ..\sys\share\dgn_yacc.c
68	   copy /b dgn_yacc.c+,,
69	   chdir ..\src
70!ELSE
71	   chdir ..\util
72	   $(YACC) -d dgn_comp.y
73	   copy $(YTABC) $@
74	   copy $(YTABH) ..\include\dgn_comp.h
75	   @del $(YTABC)
76	   @del $(YTABH)
77	   chdir ..\build
78!ENDIF
79
80..\util\dgn_lex.c: ..\util\dgn_comp.l
81!IF "$(LEX)"==""
82	   @echo Using pre-built dgn_lex.c
83	   chdir ..\util
84	   copy /y ..\sys\share\dgn_lex.c
85	   copy /b dgn_lex.c+,,
86	   chdir ..\src
87!ELSE
88	   chdir ..\util
89	   $(LEX) dgn_comp.l
90	   copy $(LEXYYC) $@
91	   @del $(LEXYYC)
92	   chdir ..\build
93!ENDIF
94