Imported Upstream version 4.1.1
[platform/upstream/gawk.git] / awklib / Makefile.am
1 #
2 # awklib/Makefile.am --- automake input file for gawk
3 #
4 # Copyright (C) 1995-2006 the Free Software Foundation, Inc.
5 #
6 # This file is part of GAWK, the GNU implementation of the
7 # AWK Programming Language.
8 #
9 # GAWK is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # GAWK is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
22 #
23
24 ## process this file with automake to produce Makefile.in
25
26 EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg
27 # With some locales, the script extract.awk fails.
28 # So we fix the locale to some sensible value.
29
30 if TEST_CROSS_COMPILE
31 AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT)
32 else
33 AWKPROG = LC_ALL=C LANG=C $(abs_top_builddir)/gawk$(EXEEXT)
34 endif
35
36 # Get config.h from the build directory and custom.h from the source directory.
37 AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
38
39 pkgdatadir = $(datadir)/awk
40 pkglibexecdir = $(libexecdir)/awk
41
42 bin_SCRIPTS = igawk
43 pkglibexec_PROGRAMS = pwcat grcat
44 AUXAWK = passwd.awk group.awk
45 nodist_grcat_SOURCES = grcat.c
46 nodist_pwcat_SOURCES = pwcat.c
47
48 all: $(srcdir)/stamp-eg $(AUXPROGS) igawk $(AUXAWK)
49
50 install-exec-hook: $(AUXAWK)
51         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
52         for i in $(AUXAWK) $(srcdir)/eg/lib/*.awk ; do \
53                 progname=`echo $$i | sed 's;.*/;;'` ; \
54                 $(INSTALL_DATA) $$i $(DESTDIR)$(pkgdatadir)/$$progname ; \
55         done
56
57 # pkglibexecdir and pkgdatadir are removed in the top level Makefile's uninstall
58 uninstall-local:
59         rm -fr $(DESTDIR)$(pkglibexecdir)/* $(DESTDIR)$(pkgdatadir)/*
60         rm -f $(DESTDIR)$(bindir)/igawk
61
62 clean-local:
63         rm -f $(AUXAWK) igawk *.exe
64         rm -fr eg.old
65         rm -fr grcat.dSYM pwcat.dSYM
66
67 $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
68         cd $(srcdir) && \
69         rm -fr eg && \
70         rm -fr stamp-eg && \
71         $(AWKPROG) -f extract.awk ../doc/gawk.texi ../doc/gawkinet.texi
72         @echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg
73         @echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg
74
75 $(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \
76 $(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @:
77
78 pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
79         $(COMPILE) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@
80
81 grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c
82         $(COMPILE) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@
83
84 igawk: $(srcdir)/eg/prog/igawk.sh
85         cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@
86
87 passwd.awk: $(srcdir)/eg/lib/passwdawk.in
88         sed 's;/usr/local/libexec/awk;$(pkglibexecdir);' < $(srcdir)/eg/lib/passwdawk.in > passwd.awk
89
90 group.awk: $(srcdir)/eg/lib/groupawk.in
91         sed 's;/usr/local/libexec/awk;$(pkglibexecdir);' < $(srcdir)/eg/lib/groupawk.in > group.awk