summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile.dos
blob: 4535c7df199c8d19c0229de4678d651fd8e9a4b3 (plain) (blame)
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
# -*- Makefile -*- for Dungeon Crawl (dos)
#
# Modified for Crawl Reference by $Author$ on $Date$

# this file contains a list of the libraries.
# it will make a variable called OBJECTS that contains all the libraries
include makefile.obj

# need .exe so make will find the right file
APPNAME = crawl.exe
CXX = gxx
DELETE = del
COPY = copy
OS_TYPE = DOS

LIB =

# If you don't have flex or bison, set DOYACC to N or empty.
DOYACC := n
LEX  := flex
YACC := bison -y

INCLUDES := -Iutil -I.

CFWARN   := -Wall -Wwrite-strings -Wshadow -Werror -pedantic
CFOTHERS := -D$(OS_TYPE) $(EXTRA_FLAGS) -fsigned-char -fstrict-aliasing

CFLAGS   := $(INCLUDES) $(CFWARN) $(CFOTHERS)
YCFLAGS  := $(INCLUDES) $(CFOTHERS)

OBJECTS += libdos.o

LDFLAGS =
# LIB = -lcurso -lpano

UTIL = util/

# DOS brain damage. What to do, what to do.
YTABC  := levcom~1.c
YTABH  := levcom~1.h

ifeq ($(LEX),)
DOYACC :=
endif

ifeq ($(YACC),)
DOYACC :=
endif

OBJECTS := $(UTIL)levcomp.o $(UTIL)levtab.o $(UTIL)levlex.o $(OBJECTS)

GAME_DEPENDS := $(OBJECTS)

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

all:            $(APPNAME)

DEPENDENCY_MKF := makefile.dep
-include $(DEPENDENCY_MKF)

##########################################################################
# The level compiler
#

# [dshaligram] A million plagues on djgpp make! It doesn't want to use a
# generic rule for $(UTIL)%.cc; it always uses the .cc.o: rule instead.

LINC :=

# [ds] If we're using the prebuilt include, we can't copy it around because
# djgpp copy mangles the name irreparably.
ifneq ($(DOYACC),y)
LINC += -I prebuilt
endif

$(UTIL)levcomp.o: $(UTIL)levcomp.cc
		$(subst /,\,$(CXX) $(LINC) $(YCFLAGS) -o $@ -c $<)

$(UTIL)levlex.o: $(UTIL)levlex.cc
		$(subst /,\,$(CXX) $(LINC) $(YCFLAGS) -o $@ -c $<)

$(UTIL)levtab.o: $(UTIL)levtab.cc
		$(subst /,\,$(CXX) $(LINC) $(YCFLAGS) -o $@ -c $<)

ifeq ($(DOYACC),y)

$(UTIL)levtab.cc: $(UTIL)levcomp.ypp
		$(subst /,\,cd $(UTIL))
		$(YACC) -d -b levcomp levcomp.ypp
		copy $(YTABC) levtab.cc
		cd ..

# djgpp flex must not have a space between -o and its parameter, or no business
# will result.
$(UTIL)levlex.cc: $(UTIL)levcomp.lpp
		$(subst /,\,cd $(UTIL))
		$(LEX) -olevlex.cc levcomp.lpp
		cd ..

else

$(UTIL)levtab.cc: prebuilt/levcom~2.cc
		$(subst /,\,$(COPY) $< $@)

$(UTIL)levlex.cc: prebuilt/levcom~1.cc
		$(subst /,\,$(COPY) $< $@)

endif

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

clean:
		$(DELETE) *.o
		$(subst /,\,$(DELETE) $(UTIL)*.o)
		$(subst /,\,$(DELETE) $(UTIL)*.exe)
		$(subst /,\,$(DELETE) $(UTIL)levcom~1.*)
		$(subst /,\,$(DELETE) $(UTIL)levtab.*)
		$(subst /,\,$(DELETE) $(UTIL)levlex.*)

distclean:
		$(DELETE) *.o 
		$(DELETE) bones.*
		$(DELETE) morgue.txt
		$(DELETE) scores 
		$(DELETE) $(APPNAME) 
		$(DELETE) *.sav
		$(DELETE) core
		$(DELETE) *.0*
		$(DELETE) *.lab

$(APPNAME):	$(GAME_DEPENDS)
		${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
		strip $(APPNAME)

debug:		$(GAME_DEPENDS)
		${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)

profile:	$(GAME_DEPENDS)
		${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)

.cc.o:
		${CXX} ${CFLAGS} -c $<

# I don't have touch for DOS, but if you do, you can put this back.
#
#.h.cc:
#		touch $@