freebsd-dev/contrib/groff/Makefile.comm

302 lines
8.2 KiB
Makefile
Raw Normal View History

2002-10-11 08:52:17 +00:00
# Copyright (C) 1989-2000, 2002 Free Software Foundation, Inc.
1996-09-07 16:18:32 +00:00
# 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
2000-12-05 18:49:44 +00:00
INCLUDES=-I. -I$(srcdir) \
-I$(top_builddir)/src/include -I$(top_srcdir)/src/include
1996-09-07 16:18:32 +00:00
ALL_CCFLAGS=$(INCLUDES) $(CCDEFINES) $(CCFLAGS) $(CPPFLAGS)
2003-05-01 13:09:50 +00:00
COMPILE.cpp=$(CCC) $(ALL_CCFLAGS) -c
2000-12-05 18:49:44 +00:00
ALL_CFLAGS=$(INCLUDES) $(CDEFINES) $(CFLAGS) $(CPPFLAGS)
2002-10-11 08:52:17 +00:00
COMPILE.c=$(CC) $(ALL_CFLAGS) -c
2003-05-01 13:09:50 +00:00
LINK.cpp=$(CCC) $(CCFLAGS) $(LDFLAGS)
1996-09-07 16:18:32 +00:00
LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
2003-05-01 13:09:50 +00:00
LIBGROFF=$(top_builddir)/src/libs/libgroff/libgroff.$(LIBEXT)
LIBBIB=$(top_builddir)/src/libs/libbib/libbib.$(LIBEXT)
LIBDRIVER=$(top_builddir)/src/libs/libdriver/libdriver.$(LIBEXT)
1996-09-07 16:18:32 +00:00
MLIB=
XLIBS=
YTABH=
YTABC=
GRAM=
LIBCLEAN=
CLEANADD=
2002-10-11 08:52:17 +00:00
CLEANDIRADD=
CLEANNOTSRCDIRADD=
1996-09-07 16:18:32 +00:00
MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
depend.temp core y.output $(CLEANADD)
CLEANFILES=$(LIBCLEAN)
2000-12-05 18:49:44 +00:00
DISTCLEANFILES=TAGS Makefile Makefile.dep
1996-09-07 16:18:32 +00:00
REALCLEANFILES=$(YTABC) $(YTABH)
NAMEPREFIX=
HDRS=
MANPAGES=$(MAN1) $(MAN5) $(MAN7)
MANCLEAN=$(MANPAGES)
fontsubdir=$(fontdir)/dev$(DEV)
all install install_bin install_data TAGS depend distfiles uninstall_sub:
2000-12-05 18:49:44 +00:00
install: prefix_must_exist install_bin install_data
1996-09-07 16:18:32 +00:00
uninstall: uninstall_sub
pure:
.PHONY: all clean distclean mostlyclean realclean extraclean depend distfiles
2000-12-05 18:49:44 +00:00
.PHONY: install install_bin install_data prefix_must_exist
1996-09-07 16:18:32 +00:00
.PHONY: uninstall uninstall_sub
.PHONY: pure
2000-12-05 18:49:44 +00:00
prefix_must_exist:
@test -d $(prefix) \
|| (echo ; \
echo The prefix directory \`$(prefix)\' doesn\'t exist; \
echo ; \
exit 1)
1996-09-07 16:18:32 +00:00
mostlyclean:
-rm -f $(MOSTLYCLEANFILES)
2002-10-11 08:52:17 +00:00
-rm -rf $(CLEANDIRADD)
-@if test `cd $(srcdir); pwd` = `pwd`; then \
:; \
else \
rm -f $(CLEANNOTSRCDIRADD); \
fi
1996-09-07 16:18:32 +00:00
2002-10-11 08:52:17 +00:00
clean: mostlyclean
-rm -f $(CLEANFILES)
1996-09-07 16:18:32 +00:00
2002-10-11 08:52:17 +00:00
distclean: clean
-rm -f $(DISTCLEANFILES)
-@if test `cd $(srcdir); pwd` = `pwd`; then \
:; \
else \
rm -f $(YTABC) $(YTABH); \
fi
1996-09-07 16:18:32 +00:00
2002-10-11 08:52:17 +00:00
realclean: distclean
-rm -f $(REALCLEANFILES)
1996-09-07 16:18:32 +00:00
2002-10-11 08:52:17 +00:00
extraclean: distclean
-rm -f \#* *~ =* core junk grot old temp tmp tem
1996-09-07 16:18:32 +00:00
.SUFFIXES:
2003-05-01 13:09:50 +00:00
.SUFFIXES: .o .obj .cpp .c .y .man .n
1996-09-07 16:18:32 +00:00
2003-05-01 13:09:50 +00:00
.cpp.o:
$(COMPILE.cpp) $<
1996-09-07 16:18:32 +00:00
.c.o:
$(COMPILE.c) $<
2003-05-01 13:09:50 +00:00
.cpp.obj:
$(COMPILE.cpp) $<
2002-10-11 08:52:17 +00:00
.c.obj:
$(COMPILE.c) $<
2003-05-01 13:09:50 +00:00
.y.cpp:
1996-09-07 16:18:32 +00:00
if test -n "$(YTABH)"; then \
$(YACC) $(YACCFLAGS) -d $<; \
else \
$(YACC) $(YACCFLAGS) $<; \
fi
2000-12-05 18:49:44 +00:00
-test -f y.tab.h && mv y.tab.h y_tab.h
-test -f y.tab.c && mv y.tab.c y_tab.c
2002-10-11 08:52:17 +00:00
mv y_tab.c $(YTABC)
if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi
# The next rule is needed for make of Solaris 2.5.1 to override its
2003-05-01 13:09:50 +00:00
# built-in .y.o rule (which takes precedence over the .y.cpp rule above).
2002-10-11 08:52:17 +00:00
.y.o:
1996-09-07 16:18:32 +00:00
if test -n "$(YTABH)"; then \
2002-10-11 08:52:17 +00:00
$(YACC) $(YACCFLAGS) -d $<; \
else \
$(YACC) $(YACCFLAGS) $<; \
1996-09-07 16:18:32 +00:00
fi
2002-10-11 08:52:17 +00:00
-test -f y.tab.h && mv y.tab.h y_tab.h
-test -f y.tab.c && mv y.tab.c y_tab.c
mv y_tab.c $(YTABC)
if test -n "$(YTABH)"; then mv y_tab.h $(YTABH); fi
2003-05-01 13:09:50 +00:00
$(COMPILE.cpp) $(YTABC)
2000-12-05 18:49:44 +00:00
1996-09-07 16:18:32 +00:00
.man.n:
@echo Making $@ from $<
@-rm -f $@
2001-04-17 12:12:05 +00:00
@sed -e "s|@BINDIR@|$(bindir)|g" \
-e "s|@FONTDIR@|$(fontdir)|g" \
2002-10-11 08:52:17 +00:00
-e "s|@LOCALFONTDIR@|$(localfontdir)|g" \
-e "s|@LEGACYFONTDIR@|$(legacyfontdir)|g" \
2000-12-05 18:49:44 +00:00
-e "s|@MACRODIR@|$(tmacdir)|g" \
2001-04-17 12:12:05 +00:00
-e "s|@SYSTEMMACRODIR@|$(systemtmacdir)|g" \
-e "s|@LOCALMACRODIR@|$(localtmacdir)|g" \
2002-10-11 08:52:17 +00:00
-e "s|@DOCDIR@|$(docdir)|g" \
-e "s|@EXAMPLEDIR@|$(exampledir)|g" \
-e "s|@HTMLDOCDIR@|$(htmldocdir)|g" \
2000-12-05 18:49:44 +00:00
-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_AN_PREFIX@|$(tmac_an_prefix)|g" \
-e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
-e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
-e "s|@VERSION@|$(version)$(revision)|g" \
-e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
-e "s|@g@|$(g)|g" \
-e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
1996-09-07 16:18:32 +00:00
$< >$@
.PHONY: install_man
install_man:
2000-12-05 18:49:44 +00:00
-test -d $(manroot) || $(mkinstalldirs) $(manroot)
-test -d $(man1dir) || $(mkinstalldirs) $(man1dir)
1996-09-07 16:18:32 +00:00
@-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
2000-12-05 18:49:44 +00:00
-test -d $(man5dir) || $(mkinstalldirs) $(man5dir)
1996-09-07 16:18:32 +00:00
@-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
2000-12-05 18:49:44 +00:00
-test -d $(man7dir) || $(mkinstalldirs) $(man7dir)
1996-09-07 16:18:32 +00:00
@-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:
2000-12-05 18:49:44 +00:00
-test -d $(bindir) || $(mkinstalldirs) $(bindir)
1996-09-07 16:18:32 +00:00
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:
2000-12-05 18:49:44 +00:00
-test -d $(datadir) || $(mkinstalldirs) $(datadir)
2001-04-17 12:12:05 +00:00
-test -d $(dataprogramdir) || $(mkinstalldirs) $(dataprogramdir)
2000-12-05 18:49:44 +00:00
-test -d $(datasubdir) || $(mkinstalldirs) $(datasubdir)
-test -d $(fontdir) || $(mkinstalldirs) $(fontdir)
-test -d $(fontsubdir) || $(mkinstalldirs) $(fontsubdir)
1996-09-07 16:18:32 +00:00
-if test -d $(srcdir)/generate; then \
2000-12-05 18:49:44 +00:00
test -d $(fontsubdir)/generate || \
$(mkinstalldirs) $(fontsubdir)/generate; \
1996-09-07 16:18:32 +00:00
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
2003-05-01 13:09:50 +00:00
-for f in $(DEVSCRIPTS); do \
rm -f $(fontsubdir)/$$f; \
if test -f $$f; then \
$(INSTALL_SCRIPT) $$f $(fontsubdir)/$$f; \
else \
$(INSTALL_SCRIPT) $(srcdir)/$$f $(fontsubdir)/$$f; \
fi; \
done
1996-09-07 16:18:32 +00:00
.PHONY: uninstall_dev
uninstall_dev:
2003-05-01 13:09:50 +00:00
-for f in $(DEVFILES) $(DEVSCRIPTS); do rm -f $(fontsubdir)/$$f; done
1996-09-07 16:18:32 +00:00
-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;
2003-05-01 13:09:50 +00:00
if test -f "$(srcdir)/$(YTABC)"; then \
ytabc="$(srcdir)/$(YTABC)"; \
else \
ytabc="$(YTABC)"; \
fi; \
2002-10-11 08:52:17 +00:00
test -z "$(CCSRCS)$(YTABC)" \
2003-05-01 13:09:50 +00:00
|| $(CCC) $(ALL_CCFLAGS) -MM $(CCSRCS) $$ytabc >>depend.temp
1996-09-07 16:18:32 +00:00
test -z "$(CSRCS)" \
|| $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
if test -n "$(YTABH)"; then \
2000-12-05 18:49:44 +00:00
sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
mv depend1.temp depend.temp; \
1996-09-07 16:18:32 +00:00
fi
.PHONY: TAGS_src
TAGS_src:
$(ETAGS) $(ETAGSFLAGS) $(CCSRCS) $(CSRCS)
test -z "$(GRAM)$(HDRS)" \
|| $(ETAGS) $(ETAGSFLAGS) -a $(ETAGSCCFLAG) $(GRAM) $(HDRS)
2002-10-11 08:52:17 +00:00
# This rule is only considered for the subdir_Makefile target.
1996-09-07 16:18:32 +00:00
Makefile:
-rm -f Makefile
echo srcdir=$(srcdir) >>Makefile
echo VPATH=$(VPATH) >>Makefile
cat $(MAKEFILEPARTS) /dev/null >>Makefile
FORCE:
.NOEXPORT: