PageRenderTime 72ms CodeModel.GetById 20ms app.highlight 47ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/groff/Makefile.comm

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 304 lines | 275 code | 29 blank | 0 comment | 0 complexity | e2ad2bc1f66d7c83a73d589fc448c800 MD5 | raw file
  1# Copyright (C) 1989-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
  2#      Written by James Clark (jjc@jclark.com)
  3# 
  4# This file is part of groff.
  5# 
  6# groff is free software; you can redistribute it and/or modify it under
  7# the terms of the GNU General Public License as published by the Free
  8# Software Foundation; either version 2, or (at your option) any later
  9# version.
 10# 
 11# groff is distributed in the hope that it will be useful, but WITHOUT ANY
 12# WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14# for more details.
 15# 
 16# You should have received a copy of the GNU General Public License along
 17# with groff; see the file COPYING.  If not, write to the Free Software
 18# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
 19#
 20# Makefile.comm
 21#
 22INCLUDES=-I. -I$(srcdir) \
 23  -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
 24ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
 25COMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c
 26ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
 27COMPILE.c=$(CC) $(ALL_CFLAGS) -c
 28LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS)
 29LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
 30LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT)
 31LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT)
 32LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT)
 33LIBXUTIL=$(top_builddir)/src/libs/libxutil/libxutil.$(LIBEXT)
 34MLIB=
 35XLIBS=
 36YTABH=
 37YTABC=
 38GRAM=
 39LIBCLEAN=
 40CLEANADD=
 41CLEANDIRADD=
 42CLEANNOTSRCDIRADD=
 43MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
 44  depend.temp core y.output $(CLEANADD)
 45CLEANFILES=$(LIBCLEAN)
 46DISTCLEANFILES=TAGS Makefile Makefile.dep
 47REALCLEANFILES=$(YTABC) $(YTABH)
 48NAMEPREFIX=
 49HDRS=
 50MANPAGES=$(MAN1) $(MAN5) $(MAN7)
 51MANCLEAN=$(MANPAGES)
 52fontsubdir=$(fontdir)/dev$(DEV)
 53
 54all install install_bin install_data TAGS depend distfiles uninstall_sub:
 55
 56install: prefix_must_exist install_bin install_data
 57uninstall: uninstall_sub
 58pure:
 59
 60.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
 61.PHONY: install install_bin install_data prefix_must_exist
 62.PHONY: uninstall uninstall_sub
 63.PHONY: pure
 64
 65prefix_must_exist:
 66	@test -d $(prefix) \
 67	  || (echo ; \
 68	      echo The prefix directory \`$(prefix)\' doesn\'t exist; \
 69	      echo ; \
 70	      exit 1)
 71
 72mostlyclean:
 73	-rm -f $(MOSTLYCLEANFILES)
 74	-rm -rf $(CLEANDIRADD)
 75	-@if test `cd $(srcdir); pwd` = `pwd`; then \
 76	  :; \
 77	else \
 78	  rm -f $(CLEANNOTSRCDIRADD); \
 79	fi
 80
 81clean: mostlyclean
 82	-rm -f $(CLEANFILES)
 83
 84distclean: clean
 85	-rm -f $(DISTCLEANFILES)
 86	-@if test `cd $(srcdir); pwd` = `pwd`; then \
 87	  :; \
 88	else \
 89	  rm -f $(YTABC) $(YTABH); \
 90	fi
 91
 92realclean: distclean
 93	-rm -f $(REALCLEANFILES)
 94
 95extraclean: distclean
 96	-rm -f \#* *~ =* core junk grot old temp tmp tem *.new *.old *.orig
 97
 98.SUFFIXES:
 99.SUFFIXES: .o .obj .cpp .c .y .man .n
100
101.cpp.o:
102	$(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
103
104.c.o:
105	$(COMPILE.c) $(EXTRA_CFLAGS) $<
106
107.cpp.obj:
108	$(COMPILE.cpp) $(EXTRA_CCFLAGS) $<
109
110.c.obj:
111	$(COMPILE.c) $(EXTRA_CFLAGS) $<
112
113.y.cpp:
114	if test -n "$(YTABH)"; then \
115	  $(YACC) $(YACCFLAGS) -d $<; \
116	else \
117	  $(YACC) $(YACCFLAGS) $<; \
118	fi
119	-test -f y.tab.h && mv y.tab.h y_tab.h
120	-test -f y.tab.c && mv y.tab.c y_tab.c
121	mv y_tab.c $(YTABC)
122	test -z "$(YTABH)" || mv y_tab.h $(YTABH)
123
124# The next rule is needed for make of Solaris 2.5.1 to override its
125# built-in .y.o rule (which takes precedence over the .y.cpp rule above).
126.y.o:
127	if test -n "$(YTABH)"; then \
128	  $(YACC) $(YACCFLAGS) -d $<; \
129	else \
130	  $(YACC) $(YACCFLAGS) $<; \
131	fi
132	-test -f y.tab.h && mv y.tab.h y_tab.h
133	-test -f y.tab.c && mv y.tab.c y_tab.c
134	mv y_tab.c $(YTABC)
135	test -z "$(YTABH)" || mv y_tab.h $(YTABH)
136	$(COMPILE.cpp) $(EXTRA_CCFLAGS) $(YTABC)
137
138.man.n:
139	@echo Making $@ from $<
140	@-rm -f $@
141	@sed -e "s|@BINDIR@|$(bindir)|g" \
142	-e "s|@FONTDIR@|$(fontdir)|g" \
143	-e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
144	-e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
145	-e "s|@MACRODIR@|$(tmacdir)|g" \
146	-e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
147	-e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
148	-e "s|@DOCDIR@|$(docdir)|g" \
149	-e "s|@EXAMPLEDIR@|$(exampledir)|g" \
150	-e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
151	-e "s|@PDFDOCDIR@|$(pdfdocdir)|g" \
152	-e "s|@DEVICE@|$(DEVICE)|g" \
153	-e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
154	-e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
155	-e "s|@INDEX_SUFFIX@|$(indexext)|g" \
156	-e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
157	-e "s|@MAN1EXT@|$(man1ext)|g" \
158	-e "s|@MAN5EXT@|$(man5ext)|g" \
159	-e "s|@MAN7EXT@|$(man7ext)|g" \
160	-e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
161	-e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
162	-e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
163	-e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
164	-e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
165	-e "s|@VERSION@|$(version)$(revision)|g" \
166	-e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
167	-e "s|@g@|$(g)|g" \
168	-e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
169	$< >$@
170
171.PHONY: install_man
172install_man:
173	-test -d $(manroot) || $(mkinstalldirs) $(manroot)
174	-test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
175	@-pages="$(MAN1)"; \
176	for p in $$pages; do \
177	 prog=`basename $$p .n`; \
178	 target=$(man1dir)/$(NAMEPREFIX)$$prog.$(man1ext); \
179	 rm -f $$target; \
180	 echo $(INSTALL_DATA) $$p $$target; \
181	 $(INSTALL_DATA) $$p $$target; \
182	done
183	-test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
184	@-pages="$(MAN5)"; \
185	for p in $$pages; do \
186	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
187	 rm -f $$target; \
188	 echo $(INSTALL_DATA) $$p $$target; \
189	 $(INSTALL_DATA) $$p $$target; \
190	done
191	-test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
192	@-pages="$(MAN7)"; \
193	for p in $$pages; do \
194	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
195	 rm -f $$target; \
196	 echo $(INSTALL_DATA) $$p $$target; \
197	 $(INSTALL_DATA) $$p $$target; \
198	done
199
200.PHONY: uninstall_man
201uninstall_man:
202	@-pages="$(MAN1)"; \
203	for p in $$pages; do \
204	 target=$(man1dir)/$(NAMEPREFIX)`basename $$p .n`.$(man1ext); \
205	 echo rm -f $$target; \
206	 rm -f $$target; \
207	done
208	@-pages="$(MAN5)"; \
209	for p in $$pages; do \
210	 target=$(man5dir)/`basename $$p .n`.$(man5ext); \
211	 echo rm -f $$target; \
212	 rm -f $$target; \
213	done
214	@-pages="$(MAN7)"; \
215	for p in $$pages; do \
216	 target=$(man7dir)/`basename $$p .n`.$(man7ext); \
217	 echo rm -f $$target; \
218	 rm -f $$target; \
219	done
220
221.PHONY: install_prog
222install_prog:
223	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
224	rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
225	$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
226
227.PHONY: uninstall_prog
228uninstall_prog:
229	-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)	
230
231.PHONY: install_dev
232install_dev:
233	-test -d $(datadir) || $(mkinstalldirs) $(datadir)
234	-test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
235	-test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
236	-test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
237	-test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
238	-if test -d $(srcdir)/generate; then \
239	  test -d $(fontsubdir)/generate \
240	    || $(mkinstalldirs) $(fontsubdir)/generate; \
241	fi
242	-test -z "$(DEVFILES)" \
243	  || for f in ""$(DEVFILES); do \
244	       rm -f $(fontsubdir)/$$f; \
245	       if test -f $$f; then \
246		 $(INSTALL_DATA) $$f $(fontsubdir)/$$f; \
247	       else \
248		 $(INSTALL_DATA) $(srcdir)/$$f $(fontsubdir)/$$f; \
249	       fi; \
250	     done
251	-test -z "$(DEVSCRIPTS)" \
252	  || for f in ""$(DEVSCRIPTS); do \
253	       rm -f $(fontsubdir)/$$f; \
254	       if test -f $$f; then \
255		 $(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \
256	       else \
257		 $(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \
258	       fi; \
259	     done
260
261.PHONY: uninstall_dev
262uninstall_dev:
263	-test -z "$(DEVFILES)$(DEVSCRIPTS)" \
264	  || for f in ""$(DEVFILES) $(DEVSCRIPTS); do \
265	       rm -f $(fontsubdir)/$$f; \
266	     done
267	-test -d $(fontsubdir)/generate && rmdir $(fontsubdir)/generate
268	-rmdir $(fontsubdir)
269
270.PHONY: depend_src
271depend_src: depend.temp
272	mv depend.temp Makefile.dep
273
274depend.temp: FORCE
275	> depend.temp;
276	if test -f "$(srcdir)/$(YTABC)"; then \
277	  ytabc="$(srcdir)/$(YTABC)"; \
278	else \
279	  ytabc="$(YTABC)"; \
280	fi; \
281	test -z "$(CCSRCS)$(YTABC)" \
282	  || $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
283	test -z "$(CSRCS)" \
284	  || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
285	test -z "$(YTABH)" \
286	  || (sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
287	      mv depend1.temp depend.temp)
288
289.PHONY: TAGS_src
290TAGS_src:
291	$(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
292	test -z "$(GRAM)$(HDRS)" \
293	  || $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
294
295# This rule is only considered for the subdir_Makefile target.
296Makefile:
297	-rm -f Makefile
298	echo srcdir=$(srcdir) >>Makefile
299	echo VPATH=$(VPATH) >>Makefile
300	cat $(MAKEFILEPARTS) /dev/null >>Makefile
301
302FORCE:
303
304.NOEXPORT: