File: unix.mak

package info (click to toggle)
tf5 5.0beta8-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,800 kB
  • ctags: 3,102
  • sloc: ansic: 25,492; perl: 103; makefile: 82; sh: 79
file content (195 lines) | stat: -rw-r--r-- 7,026 bytes parent folder | download | duplicates (7)
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
# $Id: unix.mak,v 35004.50 2007/01/13 23:12:39 kkeys Exp $
########################################################################
#  TinyFugue - programmable mud client
#  Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys
#
#  TinyFugue (aka "tf") is protected under the terms of the GNU
#  General Public License.  See the file "COPYING" for details.
#
#  DO NOT EDIT THIS FILE.
#  To make configuration changes, see "unix/README".
########################################################################

#
# unix section of src/Makefile.
#

SHELL      = /bin/sh
BUILDERS   = Makefile


default: all

install:  _all PREFIXDIRS $(TF) LIBRARY $(MANPAGE) $(SYMLINK)
	@echo
	@echo '#####################################################'
	@echo '## TinyFugue installation successful.'
	@echo '##    tf binary: $(TF)'
	@echo '##    library:   $(TF_LIBDIR)'
#	@echo '##    manpage:   $(MANPAGE)'
	@DIR=`echo $(TF) | sed 's;/[^/]*$$;;'`; \
	echo ":$(PATH):" | egrep ":$${DIR}:" >/dev/null 2>&1 || { \
	    echo "##"; \
	    echo "## Note:  $$DIR is not in your PATH."; \
	    echo "## To run tf, you will need to type its full path name"; \
	    echo "## or add $$DIR to your PATH."; \
	}
	@if test $(TF_LIBDIR) != `cat TF_LIBDIR.build`; then \
	    echo "##"; \
	    echo "## Note:  installed and compiled-in libraries disagree."; \
	    echo "## To run tf, you will need TFLIBDIR=\"$(TF_LIBDIR)\""; \
	    echo "## in your environment or the -L\"$(TF_LIBDIR)\" option."; \
	fi

all files:  _all
	@echo '$(TF_LIBDIR)' > TF_LIBDIR.build
	@echo
	@echo '#####################################################'
	@echo '## TinyFugue build successful.'
	@echo '## Use "$(MAKE) install" to install:'
	@echo '##    tf binary: $(TF)'
	@echo '##    library:   $(TF_LIBDIR)'
#	@echo '##    manpage:   $(MANPAGE)'

_all:  tf$(X) ../tf-lib/tf-help.idx

_failmsg:
#	@echo '#####################################################'
#	@echo '## TinyFugue installation FAILED.'
#	@echo '## See README for help.'
#	@if [ "$(STD_C)" != "1" ]; then \
#	    echo '## '; \
#	    echo '## TF requires a standard (ANSI/ISO 9889-1990) C compiler.'; \
#	    echo '## The standard has existed since 1989, and gcc is freely'; \
#	    echo '## available for many platforms, so there is really no'; \
#	    echo '## excuse for not having a standard compiler at this time.'; \
#	    echo '## If your system does not have one, you should complain'; \
#	    echo '## strongly to the vendor or administrator.  Do not bother'; \
#	    echo '## contacting the author of TF.'; \
#	elif [ "$(CC)" = "gcc" ]; then \
#	    echo '## '; \
#	    echo '## Perhaps $(CC) is not configured correctly.  Before'; \
#	    echo '## contacting the TF author, try setting the environment'; \
#	    echo '## variable CC to "cc", and run ./configure again.'; \
#	fi

pcre:
# ranlib is required by MacOS X, maybe others
	cd pcre-2.08 && \
	    $(MAKE) CC='$(CC)' CFLAGS='-O' O=o libpcre.a && \
	    $(RANLIB) libpcre.a

TF tf$(X):     $(OBJS) $(BUILDERS) $(PCRE)
	$(CC) $(LDFLAGS) -o tf$(X) $(OBJS) $(LIBS) -lpcre
#	@# Some stupid linkers return ok status even if they fail.
	@test -f "tf$(X)"
#	@# ULTRIX's sh errors here if strip isn't found, despite "true".
	-test -z "$(STRIP)" || $(STRIP) tf$(X) || true

PREFIXDIRS:
	test -d "$(DESTDIR)$(bindir)" || mkdir $(DESTDIR)$(bindir)
	test -d "$(DESTDIR)$(datadir)" || mkdir $(DESTDIR)$(datadir)

install_TF $(TF): tf$(X) $(BUILDERS)
	-@rm -f $(DESTDIR)$(TF)
	cp tf$(X) $(DESTDIR)$(TF)
	chmod $(MODE) $(DESTDIR)$(TF)

SYMLINK $(SYMLINK): $(DESTDIR)$(TF)
	test -z "$(SYMLINK)" || { rm -f $(SYMLINK) && ln -s $(TF) $(SYMLINK); }

LIBRARY $(TF_LIBDIR): ../tf-lib/tf-help ../tf-lib/tf-help.idx
	@echo '## Creating library directory...'
#	@# Overly simplified shell commands, to avoid problems on ultrix
	-@test -n "$(TF_LIBDIR)" || echo "TF_LIBDIR is undefined."
	test -n "$(TF_LIBDIR)"
	test -d "$(DESTDIR)$(TF_LIBDIR)" || mkdir $(DESTDIR)$(TF_LIBDIR)
	-@test -d "$(DESTDIR)$(TF_LIBDIR)" || echo "Can't make $(TF_LIBDIR) directory.  See if there is already a file with that name."
	test -d "$(DESTDIR)$(TF_LIBDIR)"
#
#	@#rm -f $(TF_LIBDIR)/*;  # wrong: this would remove local.tf, etc.
	@echo '## Copying library files...'
	cd ../tf-lib; \
	for f in *; do test -f $$f && files="$$files $$f"; done; \
	( cd $(DESTDIR)$(TF_LIBDIR); rm -f $$files tf.help tf.help.index; ); \
	cp $$files $(DESTDIR)$(TF_LIBDIR); \
	cd $(DESTDIR)$(TF_LIBDIR); \
	chmod $(MODE) $$files; chmod ugo-wx $$files
	-rm -f $(DESTDIR)$(TF_LIBDIR)/CHANGES 
	cp ../CHANGES $(DESTDIR)$(TF_LIBDIR)
	chmod $(MODE) $(DESTDIR)$(TF_LIBDIR)/CHANGES;
	chmod ugo-wx $(DESTDIR)$(TF_LIBDIR)/CHANGES
	chmod $(MODE) $(DESTDIR)$(TF_LIBDIR)
	-@cd $(DESTDIR)$(TF_LIBDIR); old=`ls replace.tf 2>/dev/null`; \
	if [ -n "$$old" ]; then \
	    echo "## WARNING: Obsolete files found in $(TF_LIBDIR): $$old"; \
	fi
	@echo '## Creating links so old library names still work...'
#	@# note: ln -sf isn't portable.
	@cd $(DESTDIR)$(TF_LIBDIR); \
	rm -f bind-bash.tf;    ln -s  kb-bash.tf   bind-bash.tf;    \
	rm -f bind-emacs.tf;   ln -s  kb-emacs.tf  bind-emacs.tf;   \
	rm -f completion.tf;   ln -s  complete.tf  completion.tf;   \
	rm -f factorial.tf;    ln -s  factoral.tf  factorial.tf;    \
	rm -f file-xfer.tf;    ln -s  filexfer.tf  file-xfer.tf;    \
	rm -f local.tf.sample; ln -s  local-eg.tf  local.tf.sample; \
	rm -f pref-shell.tf;   ln -s  psh.tf       pref-shell.tf;   \
	rm -f space_page.tf;   ln -s  spc-page.tf  space_page.tf;   \
	rm -f speedwalk.tf;    ln -s  spedwalk.tf  speedwalk.tf;    \
	rm -f stack_queue.tf;  ln -s  stack-q.tf   stack_queue.tf;  \
	rm -f worldqueue.tf;   ln -s  world-q.tf   worldqueue.tf;

makehelp: makehelp.c
	$(CC) $(CFLAGS) -o makehelp makehelp.c

__always__:

../tf-lib/tf-help: __always__
	if test -d ../help; then cd ../help; $(MAKE) tf-help; fi
	if test -d ../help; then cp ../help/tf-help ../tf-lib; fi

../tf-lib/tf-help.idx: ../tf-lib/tf-help makehelp
	$(MAKE) -f ../unix/unix.mak CC='$(CC)' CFLAGS='$(CFLAGS)' makehelp
	./makehelp < ../tf-lib/tf-help > ../tf-lib/tf-help.idx

MANPAGE $(MANPAGE): $(BUILDERS) tf.1.$(MANTYPE)man
	cp tf.1.$(MANTYPE)man $(MANPAGE)
	chmod $(MODE) $(MANPAGE)
	chmod ugo-x $(MANPAGE)

Makefile: ../unix/vars.mak ../unix/unix.mak ../configure ../configure.in
	@echo
	@echo "## WARNING: configuration should be rerun."
	@echo

uninstall:
	@echo "Remove $(TF_LIBDIR) $(TF) $(MANPAGE)"
	@echo "Is this okay? (y/n)"
	@read response; test "$$response" = "y"
	rm -f $(TF) $(MANPAGE)
	rm -rf $(TF_LIBDIR)

clean distclean cleanest:
	cd ..; make -f unix/Makefile $@


# development stuff, not necessarily portable.

tags: *.[ch]
	ctags --excmd=pattern port.h tf.h *.[ch] 2>/dev/null

dep: *.c
	gcc -E -MM *.c \
		| sed 's;pcre[^ ]*/pcre.h ;;' \
		| sed '/[^\\]$$/s/$$/ $$(BUILDERS)/' \
		> dep

tf.pixie: tf$(X)
	pixie -o tf.pixie tf$(X)

lint:
	lint -woff 128 $(CFLAGS) -DHAVE_PROTOTYPES $(SOURCE) $(LIBRARIES)

# The next line is a hack to get around a bug in BSD/386 make.
make: