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
|
#
# Makefile for fortune-mod
#
# Where does the fortune program go?
FORTDIR=$(prefix)/usr/games
# Where do the data files (fortunes, or cookies) go?
COOKIEDIR=$(prefix)/usr/share/games/fortunes
# Offensive ones?
OCOOKIEDIR=$(COOKIEDIR)/off
# The ones with html tags?
WCOOKIEDIR=$(COOKIEDIR)/html
# Where do strfile and unstr go?
BINDIR=$(prefix)/usr/sbin
# What is the proper mode for strfile and unstr? 755= everyone, 700= root only
BINMODE=0755
#BINMODE=0700
# Where do the man pages for strfile and unstr go?
BINMANDIR=$(prefix)/usr/man/man8
# What is their proper extension?
BINMANEXT=8
# And the same for the fortune man page
FORTMANDIR=$(prefix)/usr/man/man6
FORTMANEXT=6
# Do we want to install the offensive files? (0 no, 1 yes)
OFFENSIVE=1
# Do we want to install files with html tags? (0 no, 1 yes)
# (Note: These files are not yet available)
WEB=0
#
# Include whichever of the following defines that are appropriate
# for your system into REGEXDEFS:
#
# -DHAVE_REGEX_H
# For systems that declare their regex functions in <regex.h>
# -DHAVE_REGEXP_H
# For systems that declare their regex functions in <regexp.h>
# -DHAVE_RX_H
# For systems that declare their regex functions in <rx.h>
# -DBSD_REGEX
# For systems with BSD-compatible regex functions
# -DPOSIX_REGEX
# For systems with POSIX-compatible regex functions
#
# NB. Under Linux, the BSD regex functions are _MUCH_ faster
# than the POSIX ones, but your mileage may vary.
#
REGEXDEFS=-DHAVE_REGEX_H -DBSD_REGEX
#
# If your system's regex functions are not in its standard C library,
# include the appropriate link flags into REGEXLIBS
#
REGEXLIBS=
DEFINES=-DFORTDIR="\"$(COOKIEDIR)\"" -DOFFDIR="\"$(OCOOKIEDIR)\""
CFLAGS=-O2 $(DEFINES) -Wall -fomit-frame-pointer -pipe
LDFLAGS=-s
# The above flags are used by default; the debug flags are used when make
# is called with a debug target, such as 'make debug'
# to get a list of the possible targets, try 'make help'
# All targets are available at the top level, which exports the
# variables to sub-makes. Avoid makes in subdirectories; cd .. and
# make <target> instead.
DEBUGCFLAGS=-g -DDEBUG $(DEFINES) -Wall
DEBUGLDFLAGS=
# Only ANSI-compatible C compilers are currently supported
CC=gcc
# ----------------------------------------
# Nothing below this line should have to be changed
SUBDIRS=fortune util datfiles
.PHONY: all debug fortune-bin fortune-debug util-bin randstr rot \
util-debug cookies cookies-z install install-fortune \
install-util install-man install-fman install-uman \
clean love help
# By default, compile optimized versions
all: fortune-bin util-bin cookies-z
# Create debugging versions
debug: fortune-debug util-debug cookies-z
# Just create the fortune binary
fortune-bin:
cd fortune && $(MAKE) CC='$(CC)' \
CFLAGS='$(CFLAGS) $(REGEXDEFS) -I../util' \
LDFLAGS='$(LDFLAGS)' LIBS='$(REGEXLIBS)'
fortune-debug:
cd fortune && $(MAKE) CC='$(CC)' \
CFLAGS='$(DEBUGCFLAGS) $(REGEXDEFS) -I../util' \
LDFLAGS='$(DEBUGLDFLAGS)' LIBS='$(REGEXLIBS)'
util-bin:
cd util && $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS)' \
LDFLAGS='$(LDFLAGS)'
# Not listed in help
randstr:
cd util && $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS)' \
LDFLAGS='$(LDFLAGS)' randstr
util-debug:
cd util && $(MAKE) CC='$(CC)' CFLAGS='$(DEBUGCFLAGS)' \
LDFLAGS='$(DEBUGLDFLAGS)'
cookies:
@echo "Try the kitchen, silly!" ; sleep 3
@echo "Sorry, just joking."
$(MAKE) cookies-z
cookies-z: util-bin
cd datfiles && $(MAKE) COOKIEDIR=$(COOKIEDIR) \
OCOOKIEDIR=$(OCOOKIEDIR) WCOOKIEDIR=$(WCOOKIEDIR) \
OFFENSIVE=$(OFFENSIVE) WEB=$(WEB)
# Install everything
install: install-fortune install-util install-man install-cookie
# Install just the fortune program
install-fortune: fortune-bin
install -m 0755 -d $(FORTDIR)
install -m 0755 fortune/fortune $(FORTDIR)
# Install just the utilities strfile and unstr
install-util: util-bin
install -m 0755 -d $(BINDIR)
install -m $(BINMODE) util/strfile $(BINDIR)
install -m $(BINMODE) util/unstr $(BINDIR)
# Install all the man pages
install-man: install-fman install-uman
# Note: this rule concatenates the parts of the man page with the locally
# defined pathnames (which should reduce confusion).
fortune/fortune.man: fortune/fortune-man.part1 fortune/fortune-man.part2
@echo -n "Building fortune/fortune.man ... "
@cat fortune/fortune-man.part1 >fortune/fortune.man
@echo ".I $(COOKIEDIR)" >>fortune/fortune.man
@echo "Directory for innoffensive fortunes." >>fortune/fortune.man
@echo ".TP" >>fortune/fortune.man
@echo ".I $(OCOOKIEDIR)" >>fortune/fortune.man
@echo "Directory for offensive fortunes." >>fortune/fortune.man
@cat fortune/fortune-man.part2 >>fortune/fortune.man
@echo done.
# Install the fortune man pages
install-fman: fortune/fortune.man
install -m 0755 -d $(FORTMANDIR)
install -m 0644 fortune/fortune.man $(FORTMANDIR)/fortune.$(FORTMANEXT)
# Install the utilities man pages
install-uman:
install -m 0755 -d $(BINMANDIR)
install -m 0644 util/strfile.man $(BINMANDIR)/strfile.$(BINMANEXT)
rm -f $(BINMANDIR)/unstr.$(BINMANEXT)
(cd $(BINMANDIR) && ln -sf strfile.$(BINMANEXT).gz $(BINMANDIR)/unstr.$(BINMANEXT).gz)
# Install the fortune cookie files
install-cookie: cookies-z
cd datfiles && $(MAKE) COOKIEDIR=$(COOKIEDIR) \
OCOOKIEDIR=$(OCOOKIEDIR) WCOOKIEDIR=$(WCOOKIEDIR) \
OFFENSIVE=$(OFFENSIVE) WEB=$(WEB) install
clean:
for i in $(SUBDIRS) ; do (cd $$i && $(MAKE) clean); done
love:
@echo "Not war?" ; sleep 3
@echo "Look, I'm not equipped for that, okay?" ; sleep 2
@echo "Contact your hardware vendor for appropriate mods."
help:
@echo "Targets:"
@echo
@echo "all: make all the binaries and data files (the default target)"
@echo " fortune-bin: make the fortune binary"
@echo " util-bin: make the strfile and unstr binaries"
@echo " cookies: make the fortune-cookie data files"
@echo
@echo "debug: make debugging versions of the binaries"
@echo " fortune-debug: Just the fortune program"
@echo " util-debug: Just strfile and unstr"
@echo
@echo "install: install the files in locations specified in Makefile"
@echo " install-fortune: Just the fortune program"
@echo " install-util: Just strfile and unstr"
@echo " install-cookie: Just the fortune string and data files"
@echo " install-man: Just the man pages"
@echo " install-fman: Just the fortune man page"
@echo " install-uman: Just the strfile/unstr man page"
@echo
@echo "clean: Remove object files and binaries"
@echo
@echo "help: This screen"
@echo
@echo "love: What a *good* idea! Let's!"
|