summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/groff/Makefile.comm
blob: 5096685f499417f862c13c2de942104e6abba405 (plain)
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
#      Written by James Clark (jjc@jclark.com)
# 
# This file is part of groff.
# 
# groff is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
# 
# groff is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License along
# with groff; see the file COPYING.  If not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Makefile.comm
#
SHELL=/bin/sh
INCLUDES=-I. -I$(srcdir) -I../include -I$(srcdir)/../include
ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
COMPILE.cc=$(CCC) $(ALL_CCFLAGS) -c
ALL_CFLAGS=$(CDEFINES) $(CFLAGS) $(CPPFLAGS)
COMPILE.c=$(CC) $(ALL_CFLAGS)  -c
LINK.cc=$(CCC) $(CCFLAGS) $(LDFLAGS)
LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
TOP=..
LIBGROFF=$(TOP)/libgroff/libgroff.a
LIBBIB=$(TOP)/libbib/libbib.a
LIBDRIVER=$(TOP)/libdriver/libdriver.a
LIBM=-lm
MLIB=
XLIBS=
YTABH=
YTABC=
GRAM=
LIBCLEAN=
CLEANADD=
MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
  depend.temp core y.output $(CLEANADD)
CLEANFILES=$(LIBCLEAN)
DISTCLEANFILES=TAGS Makefile
REALCLEANFILES=$(YTABC) $(YTABH)
NAMEPREFIX=
HDRS=
MANPAGES=$(MAN1) $(MAN5) $(MAN7)
MANCLEAN=$(MANPAGES)
fontsubdir=$(fontdir)/dev$(DEV)

# Target to use for installing unformatted man-pages.  Some systems may not
# want them installed.                                   
INSTALL_MAN=install_man

all install install_bin install_data $(INSTALL_MAN) TAGS depend distfiles uninstall_sub:

install: install_bin install_data $(INSTALL_MAN)
uninstall: uninstall_sub
pure:

.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
.PHONY: install install_bin install_data $(INSTALL_MAN)
.PHONY: uninstall uninstall_sub
.PHONY: pure

mostlyclean:
	-rm -f $(MOSTLYCLEANFILES)

clean:
	-rm -f $(CLEANFILES) $(MOSTLYCLEANFILES)

distclean:
	-rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES)

realclean:
	-rm -f $(REALCLEANFILES) $(DISTCLEANFILES) $(CLEANFILES) \
	  $(MOSTLYCLEANFILES)

extraclean:
	-rm -f $(DISTCLEANFILES) $(CLEANFILES) $(MOSTLYCLEANFILES) \
	  \#* *~ =* core junk grot old temp tmp tem

.SUFFIXES:
.SUFFIXES: .o .cc .c .y .man .n

.cc.o:
	$(COMPILE.cc) $<

.c.o:
	$(COMPILE.c) $<

.y.cc:
	if test -n "$(YTABH)"; then \
	  $(YACC) $(YACCFLAGS) -d $<; \
	else \
	  $(YACC) $(YACCFLAGS) $<; \
	fi
	mv y.tab.c $@
# Avoid ending up with two versions of $(YTABH).
	if test -n "$(YTABH)"; then \
	  if test -f $(srcdir)/$(YTABH); then \
	    rm -f $(YTABH); \
	    mv y.tab.h $(srcdir)/$(YTABH); \
	  else \
	    mv y.tab.h $(YTABH); \
	  fi; \
	fi

.man.n:
	@echo Making $@ from $<
	@-rm -f $@
	@sed -e "s;@FONTDIR@;$(fontdir);g" \
	-e "s;@FONTPATH@;$(fontpath);g" \
	-e "s;@MACRODIR@;$(tmacdir);g" \
	-e "s;@MACROPATH@;$(tmacpath);g" \
	-e "s;@DEVICE@;$(DEVICE);g" \
	-e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
	-e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
	-e "s;@INDEX_SUFFIX@;$(indexext);g" \
	-e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
	-e "s;@MAN1EXT@;$(man1ext);g" \
	-e "s;@MAN5EXT@;$(man5ext);g" \
	-e "s;@MAN7EXT@;$(man7ext);g" \
	-e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
	-e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
	-e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
	-e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
	-e "s;@VERSION@;`cat $(srcdir)/../VERSION`;g" \
	-e "s;@MDATE@;`$(SHELL) $(srcdir)/../mdate.sh $<`;g" \
	-e "s;@g@;$(g);g" \
	-e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
	$< >$@

.PHONY: install_man
install_man:
	-test -d $(manroot) || mkdir $(manroot)
	-test -d $(man1dir) || mkdir $(man1dir)
	@-pages="$(MAN1)"; \
	for p in $$pages; do \
	 prog=`basename $$p .n`; \
	 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
	 rm -f $$target; \
	 echo $(INSTALL_DATA) $$p $$target; \
	 $(INSTALL_DATA) $$p $$target; \
	done
	-test -d $(man5dir) || mkdir $(man5dir)
	@-pages="$(MAN5)"; \
	for p in $$pages; do \
	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
	 rm -f $$target; \
	 echo $(INSTALL_DATA) $$p $$target; \
	 $(INSTALL_DATA) $$p $$target; \
	done
	-test -d $(man7dir) || mkdir $(man7dir)
	@-pages="$(MAN7)"; \
	for p in $$pages; do \
	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
	 rm -f $$target; \
	 echo $(INSTALL_DATA) $$p $$target; \
	 $(INSTALL_DATA) $$p $$target; \
	done

.PHONY: uninstall_man
uninstall_man:
	@-pages="$(MAN1)"; \
	for p in $$pages; do \
	 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
	 echo rm -f $$target; \
	 rm -f $$target; \
	done
	@-pages="$(MAN5)"; \
	for p in $$pages; do \
	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
	 echo rm -f $$target; \
	 rm -f $$target; \
	done
	@-pages="$(MAN7)"; \
	for p in $$pages; do \
	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
	 echo rm -f $$target; \
	 rm -f $$target; \
	done

.PHONY: install_prog
install_prog:
	-test -d $(bindir) || mkdir $(bindir)
	rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
	$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)

.PHONY: uninstall_prog
uninstall_prog:
	-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)	

.PHONY: install_dev
install_dev:
	-test -d $(datadir) || mkdir $(datadir)
	-test -d $(datasubdir) || mkdir $(datasubdir)
	-test -d $(fontdir) || mkdir $(fontdir)
	-test -d $(fontsubdir) || mkdir $(fontsubdir)
	-if test -d $(srcdir)/generate; then \
	  test -d $(fontsubdir)/generate || mkdir $(fontsubdir)/generate; \
	fi
	-for f in $(DEVFILES); do \
	  rm -f $(fontsubdir)/$$f; \
	  if test -f $$f; then \
	    $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
	  fi; \
	done

.PHONY: uninstall_dev
uninstall_dev:
	-for f in $(DEVFILES); do rm -f $(fontsubdir)/$$f; done
	-if test -d $(fontsubdir)/generate; then \
	  rmdir $(fontsubdir)/generate; \
	fi
	-rmdir $(fontsubdir)

.PHONY: depend_src
depend_src: depend.temp
	mv depend.temp Makefile.dep

depend.temp: FORCE
	> depend.temp;
	test -z "$(CCSRCS)$(YTABC)"  \
	  || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $(YTABC) >>depend.temp
	test -z "$(CSRCS)" \
	  || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
	if test -n "$(YTABH)"; then \
	  sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \
	  mv depend.temp1 depend.temp; \
	fi

.PHONY: TAGS_src
TAGS_src:
	$(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
	test -z "$(GRAM)$(HDRS)" \
	  || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)

Makefile:
	-rm -f Makefile
	echo srcdir=$(srcdir) >>Makefile
	echo VPATH=$(VPATH) >>Makefile
	cat $(MAKEFILEPARTS) /dev/null >>Makefile

FORCE:

.NOEXPORT: