Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 #
2 # Makefile for fortune-mod
3 #
4
5 # Where does the fortune program go?
6 FORTDIR=$(prefix)/usr/games
7 # Where do the data files (fortunes, or cookies) go?
8 COOKIEDIR=$(prefix)/usr/share/games/fortunes
9 # Offensive ones?
10 OCOOKIEDIR=$(COOKIEDIR)/off
11 # The ones with html tags?
12 WCOOKIEDIR=$(COOKIEDIR)/html
13 # Where do local data files go?
14 LOCALDIR=$(prefix)/usr/local/share/games/fortunes
15 # Offensive ones?
16 LOCALODIR=$(LOCALDIR)/off
17 # With HTML tags?
18 LOCALWDIR=$(LOCALDIR)/html
19 # Where do strfile and unstr go?
20 BINDIR=$(prefix)/usr/bin
21 # What is the proper mode for strfile and unstr? 755= everyone, 700= root only
22 BINMODE=0755
23 #BINMODE=0700
24 # Where do the man pages for strfile and unstr go?
25 BINMANDIR=$(prefix)/usr/share/man/man1
26 # What is their proper extension?
27 BINMANEXT=1
28 # And the same for the fortune man page
29 FORTMANDIR=$(prefix)/usr/share/man/man6
30 FORTMANEXT=6
31 # Do we want to install the offensive files? (0 no, 1 yes)
32 OFFENSIVE=1
33 # Do we want to install files with html tags? (0 no, 1 yes)
34 # (Note: These files are not yet available)
35 WEB=0
36
37 #
38 # Include whichever of the following defines that are appropriate
39 # for your system into REGEXDEFS:
40 #
41 # -DHAVE_REGEX_H
42 # For systems that declare their regex functions in <regex.h>
43 # -DHAVE_REGEXP_H
44 # For systems that declare their regex functions in <regexp.h>
45 # -DHAVE_RX_H
46 # For systems that declare their regex functions in <rx.h>
47 # -DBSD_REGEX
48 # For systems with BSD-compatible regex functions
49 # -DPOSIX_REGEX
50 # For systems with POSIX-compatible regex functions
51 # -DHAVE_STDBOOL
52 # For GNU system that declare bool type in <stdbool.h>
53 #
54 # NB. Under Linux, the BSD regex functions are _MUCH_ faster
55 # than the POSIX ones, but your mileage may vary.
56 #
57 REGEXDEFS=-DHAVE_REGEX_H -DBSD_REGEX -DHAVE_STDBOOL
58
59 #
60 # If your system's regex functions are not in its standard C library,
61 # include the appropriate link flags into REGEXLIBS
62 #
63 REGEXLIBS=
64
65 RECODELIBS=-lrecode
66
67 DEFINES=-DFORTDIR="\"$(COOKIEDIR)\"" -DOFFDIR="\"$(OCOOKIEDIR)\"" -DLOCFORTDIR="\"$(LOCALDIR)\"" -DLOCOFFDIR="\"$(LOCALODIR)\""
•68
69 # Inherit CFLAGS from the environment, else use
70 CFLAGS ?= -O2
71 # Anyway, append
72 CFLAGS += $(DEFINES) -Wall -fomit-frame-pointer -pipe -fsigned-char
73
74 # Inherit LDFLAGS from the environment, else use
75 LDFLAGS ?= -s
76
77 # The above flags are used by default; the debug flags are used when make
78 # is called with a debug target, such as 'make debug'
79
80 # to get a list of the possible targets, try 'make help'
81
82 # All targets are available at the top level, which exports the
83 # variables to sub-makes. Avoid makes in subdirectories; cd .. and
84 # make <target> instead.
85
86 DEBUGCFLAGS=-g -DDEBUG $(DEFINES) -Wall
87 DEBUGLDFLAGS=
88
89 # Only ANSI-compatible C compilers are currently supported
90 CC=gcc
91
92 # ----------------------------------------
93 # Nothing below this line should have to be changed
94
95 SUBDIRS=fortune util datfiles
96
97 .PHONY: all debug fortune-bin fortune-debug util-bin randstr rot \
98 util-debug cookies cookies-z install install-fortune \
99 install-util install-man install-fman install-uman \
100 clean love help
101
102 # By default, compile optimized versions
103 all: fortune-bin util-bin cookies-z
104
105 # Create debugging versions
106 debug: fortune-debug util-debug cookies-z
107
108 # Just create the fortune binary
109 fortune-bin:
110 cd fortune && $(MAKE) CC='$(CC)' \
111 CFLAGS='$(CFLAGS) $(REGEXDEFS) -I../util' \
112 LDFLAGS='$(LDFLAGS)' LIBS='$(REGEXLIBS) $(RECODELIBS)'
113
114 fortune-debug:
115 cd fortune && $(MAKE) CC='$(CC)' \
116 CFLAGS='$(DEBUGCFLAGS) $(REGEXDEFS) -I../util' \
117 LDFLAGS='$(DEBUGLDFLAGS)' LIBS='$(REGEXLIBS)'
118
119 util-bin:
120 cd util && $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS)' \
121 LDFLAGS='$(LDFLAGS)'
122
123 # Not listed in help
124 randstr:
125 cd util && $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS)' \
126 LDFLAGS='$(LDFLAGS)' randstr
127
128 util-debug:
129 cd util && $(MAKE) CC='$(CC)' CFLAGS='$(DEBUGCFLAGS)' \
130 LDFLAGS='$(DEBUGLDFLAGS)'
131
132 cookies:
133 @echo "Try the kitchen, silly!" ; sleep 3
134 @echo "Sorry, just joking."
135 $(MAKE) cookies-z
136
137 cookies-z: util-bin
138 cd datfiles && $(MAKE) COOKIEDIR=$(COOKIEDIR) \
139 OCOOKIEDIR=$(OCOOKIEDIR) WCOOKIEDIR=$(WCOOKIEDIR) \
140 OFFENSIVE=$(OFFENSIVE) WEB=$(WEB)
141
142 # Install everything
143 install: install-fortune install-util install-man install-cookie
144
145 # Install just the fortune program
146 install-fortune: fortune-bin
147 install -m 0755 -d $(FORTDIR)
148 install -m 0755 fortune/fortune $(FORTDIR)
149
150 # Install just the utilities strfile and unstr
151 install-util: util-bin
152 install -m 0755 -d $(BINDIR)
153 install -m $(BINMODE) util/strfile $(BINDIR)
154 install -m $(BINMODE) util/unstr $(BINDIR)
155
156 # Install all the man pages
157 install-man: install-fman install-uman
158
159 # Note: this rule concatenates the parts of the man page with the locally
160 # defined pathnames (which should reduce confusion).
161 fortune/fortune.man: fortune/fortune-man.part1 fortune/fortune-man.part2
162 @echo -n "Building fortune/fortune.man ... "
163 @cat fortune/fortune-man.part1 >fortune/fortune.man
164 @echo ".I $(COOKIEDIR)" >>fortune/fortune.man
165 @echo "Directory for innoffensive fortunes." >>fortune/fortune.man
166 @echo ".TP" >>fortune/fortune.man
167 @echo ".I $(OCOOKIEDIR)" >>fortune/fortune.man
168 @echo "Directory for offensive fortunes." >>fortune/fortune.man
169 @cat fortune/fortune-man.part2 >>fortune/fortune.man
170 @echo done.
171
172 # Install the fortune man pages
173 install-fman: fortune/fortune.man
174 install -m 0755 -d $(FORTMANDIR)
175 install -m 0644 fortune/fortune.man $(FORTMANDIR)/fortune.$(FORTMANEXT)
176
177 # Install the utilities man pages
178 install-uman:
179 install -m 0755 -d $(BINMANDIR)
180 install -m 0644 util/strfile.man $(BINMANDIR)/strfile.$(BINMANEXT)
181 rm -f $(BINMANDIR)/unstr.$(BINMANEXT)
182 (cd $(BINMANDIR) && ln -sf strfile.$(BINMANEXT).gz $(BINMANDIR)/unstr.$(BINMANEXT).gz)
183
184 # Install the fortune cookie files
185 install-cookie: cookies-z
186 cd datfiles && $(MAKE) COOKIEDIR=$(COOKIEDIR) \
187 OCOOKIEDIR=$(OCOOKIEDIR) WCOOKIEDIR=$(WCOOKIEDIR) \
188 OFFENSIVE=$(OFFENSIVE) WEB=$(WEB) install
189
190 clean:
191 for i in $(SUBDIRS) ; do (cd $$i && $(MAKE) clean); done
192
193 love:
194 @echo "Not war?" ; sleep 3
195 @echo "Look, I'm not equipped for that, okay?" ; sleep 2
196 @echo "Contact your hardware vendor for appropriate mods."
197
198 help:
199 @echo "Targets:"
200 @echo
201 @echo "all: make all the binaries and data files (the default target)"
202 @echo " fortune-bin: make the fortune binary"
203 @echo " util-bin: make the strfile and unstr binaries"
204 @echo " cookies: make the fortune-cookie data files"
205 @echo
206 @echo "debug: make debugging versions of the binaries"
207 @echo " fortune-debug: Just the fortune program"
208 @echo " util-debug: Just strfile and unstr"
209 @echo
210 @echo "install: install the files in locations specified in Makefile"
211 @echo " install-fortune: Just the fortune program"
212 @echo " install-util: Just strfile and unstr"
213 @echo " install-cookie: Just the fortune string and data files"
214 @echo " install-man: Just the man pages"
215 @echo " install-fman: Just the fortune man page"
216 @echo " install-uman: Just the strfile/unstr man page"
217 @echo
218 @echo "clean: Remove object files and binaries"
219 @echo
220 @echo "help: This screen"
221 @echo
222 @echo "love: What a *good* idea! Let's!"