This repository has been archived by the owner on Apr 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
94 lines (77 loc) · 2.44 KB
/
Makefile
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
#
# MacOS X Makefile for fortune
# This fortune source was taken from FreeBSD-current on July 10, 1999
# Go to ftp://ftp.freebsd.org/pub/FreeBSD/ to get the original sources
#
# Chris Saldanha <[email protected]>
# July 12, 1999
#
#
# This file customized for MacOS X with install and remove options.
# Also cleaned up fortune.c and regex.c to get rid of some warnings.
#
# Scott Lahteine <[email protected]>
# November 17, 2006
#
# Updated the Makefile to force a 32-bit build on 64 bit systems
# November 24, 2009
#
# Updated the Makefile and the fortune.c file to allow users to specify
# files to choose fortune from (eg fortune kids) and so that it correctly
# output the contents of fortune -f
# May 6, 2011
#
# [See README.ORIG for the original README included with fortune.]
#
GAMEPATH = /usr/local/bin
DATAPATH = /usr/local/var
TRUEDATAPATH = /usr/local/var/fortunes
MANPATH = /usr/local/share/man
CFLAGS = -m32 -Os -pipe
LDFLAGS =
OBJS =
all: fortune strfile unstr
prepare:
mkdir -p work
regexpr: prepare
$(CC) -c $(CFLAGS) $(LDFLAGS) regexpr.c
fortune: prepare regexpr.o
@echo "#define FORTDIR \"$(DATAPATH)\"\n#define TRUEFORTDIR \"$(TRUEDATAPATH)\"" >pathnames.h
$(CC) $(CFLAGS) $(LDFLAGS) -o work/fortune fortune.c regexpr.o
strfile: prepare
$(CC) $(CFLAGS) $(LDFLAGS) -o work/strfile strfile.c
unstr: prepare
$(CC) $(CFLAGS) $(LDFLAGS) -o work/unstr unstr.c
clean:
rm -rf package work *.o
@echo "Cleaned"
install:
@echo "Installing..."
mkdir -p $(GAMEPATH)
mkdir -p $(DATAPATH)
mkdir -p $(MANPATH)/man6
mkdir -p $(MANPATH)/man8
cp work/* $(GAMEPATH)/
cp -r fortunes $(DATAPATH)/
cp fortune.6 $(MANPATH)/man6/
cp strfile.8 $(MANPATH)/man8/
package: all
@echo -n "Making local install package..."
@mkdir -p package/bin
@mkdir -p package/var
@mkdir -p package/share/man/man6
@mkdir -p package/share/man/man8
@cp work/* package/bin/
@cp -R fortunes package/var/
@cp fortune.6 package/share/man/man6
@cp strfile.8 package/share/man/man8
@echo " Done."
uninstall: remove
remove:
@echo "Uninstalling fortune..."
@if [ -f $(GAMEPATH)/fortune ]; then rm $(GAMEPATH)/fortune; fi
@if [ -f $(GAMEPATH)/strfile ]; then rm $(GAMEPATH)/strfile; fi
@if [ -f $(GAMEPATH)/unstr ]; then rm $(GAMEPATH)/unstr; fi
@if [ -d $(DATAPATH)/fortunes ]; then rm -r $(DATAPATH)/fortunes; fi
@if [ -f $(MANPATH)/man6/fortune.6 ]; then rm $(MANPATH)/man6/fortune.6; fi
@if [ -f $(MANPATH)/man8/strfile.8 ]; then rm $(MANPATH)/man8/strfile.8; fi