1 # Makefile.sub for `chem' (integration into the `groff' source tree)
3 # File position: <groff-source>/contrib/chem/Makefile.sub
5 # Copyright (C) 2006, 2009 Free Software Foundation, Inc.
6 # Written by Bernd Warken.
8 # Last update: 5 Jan 2009
10 # This file is part of `chem' which is part of `groff'.
12 # `groff' is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # `groff' is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ########################################################################
28 MOSTLYCLEANADD=chem chem.n README examples/README
30 # not all make programs have $(RM) predefined.
33 all: README examples/README chem $(MAN1)
35 README: $(srcdir)/README.txt
36 sed -e "s|@g@|$(g)|g" $? >$@
38 examples/README: $(srcdir)/examples/README.txt
39 -test -d examples || $(mkinstalldirs) examples
40 sed -e "s|@g@|$(g)|g" $? >$@
42 chem: $(srcdir)/chem.pl $(SH_DEPS_SED_SCRIPT)
43 sed -f "$(SH_DEPS_SED_SCRIPT)" \
45 -e "s|@BINDIR@|$(DESTDIR)$(bindir)|g" \
46 -e "s|@MACRODIR@|$(DESTDIR)$(tmacdir)|g" \
47 -e "s|@PICDIR@|$(DESTDIR)$(datasubdir)/pic|g" \
48 -e "s|@VERSION@|$(version)$(revision)|g" \
49 -e "$(SH_SCRIPT_SED_CMD)" \
54 README examples/README \
56 $(srcdir)/examples/*.chem $(srcdir)/examples/122/*
57 -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
58 $(RM) $(DESTDIR)$(bindir)/$(g)chem
59 $(INSTALL_SCRIPT) chem $(DESTDIR)$(bindir)/$(g)chem
60 -test -d $(DESTDIR)$(datasubdir)/pic \
61 || $(mkinstalldirs) $(DESTDIR)$(datasubdir)/pic
62 $(RM) $(DESTDIR)$(datasubdir)/pic/chem.pic
63 $(INSTALL_DATA) $(srcdir)/chem.pic \
64 $(DESTDIR)$(datasubdir)/pic/chem.pic
65 -test -d $(DESTDIR)$(exampledir)/chem \
66 || $(mkinstalldirs) $(DESTDIR)$(exampledir)/chem/122
67 -test -d $(DESTDIR)$(exampledir)/chem/122 \
68 || $(mkinstalldirs) $(DESTDIR)$(exampledir)/chem/122
69 -$(RM) $(DESTDIR)$(exampledir)/chem/*
70 $(INSTALL_DATA) examples/README \
71 $(DESTDIR)$(exampledir)/chem/README
72 for i in $(srcdir)/examples/*.chem; do \
73 n=`echo $$i | sed 's|$(srcdir)/examples/||g'`; \
74 $(INSTALL_DATA) $$i $(DESTDIR)$(exampledir)/chem/$$n; \
76 -$(RM) $(DESTDIR)$(exampledir)/chem/122/*
77 for i in $(srcdir)/examples/122/*; do \
78 n=`echo $$i | sed 's|$(srcdir)/examples/122/||g'`; \
79 $(INSTALL_DATA) $$i $(DESTDIR)$(exampledir)/chem/122/$$n; \
83 $(RM) $(DESTDIR)$(bindir)/chem
84 $(RM) $(DESTDIR)$(datasubdir)/pic/chem.pic
85 -rmdir $(DESTDIR)$(datasubdir)/pic
86 $(RM) $(DESTDIR)$(exampledir)/chem/122/*
87 -rmdir $(DESTDIR)$(exampledir)/chem/122
88 $(RM) $(DESTDIR)$(exampledir)/chem/*
89 -rmdir $(DESTDIR)$(exampledir)/chem
90 -rmdir $(DESTDIR)$(exampledir)
92 ########################################################################
94 ########################################################################