1## Makefile for program src directory in GNU Shar utilities package.
2##
3## Copyright (C) 1995-2015 Free Software Foundation, Inc.
4##
5## This program is free software; you can redistribute it and/or modify
6## it under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 3, or (at your option)
8## any later version.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License along
16## with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18## Process this file with automake to produce Makefile.in.
19
20# stolen from fileutils-4.1.9:
21# Sometimes, the expansion of $(LIBINTL) includes -lc which may
22# include modules defining variables like `optind', so libfetish.a
23# must precede $(LIBINTL) in order to ensure we use GNU getopt.
24# But libgnu.a must also follow $(LIBINTL), since libintl uses
25# replacement functions defined in libgnu.a.
26
27LDADD = $(top_builddir)/libopts/libopts.a $(top_builddir)/lib/libgnu.a \
28	$(top_builddir)/lib/libgnu.a \
29	$(GETHOSTNAME_LIB) $(LIBSOCKET) $(LIB_CRYPTO) $(LIBINTL)
30
31shar_LDADD      = $(LDADD)
32unshar_LDADD    = $(LDADD)
33bin_PROGRAMS    = shar unshar
34
35shar_opt_code   = shar-opts.c     shar-opts.h
36unshar_opt_code = unshar-opts.c   unshar-opts.h
37encode_opt_code = uuencode-opts.c uuencode-opts.h
38decode_opt_code = uudecode-opts.c uudecode-opts.h
39
40shar_opts       = shar-opts.def
41shar_extra      = scripts.x scribble.c scribble.h
42unshar_opts     = unshar-opts.def
43encode_opts	= uuencode-opts.def
44decode_opts	= uudecode-opts.def
45options_defs    = shar-std.def $(shar_opts) $(unshar_opts) \
46	$(encode_opts) $(decode_opts)
47usage_texts     = \
48	shar-full-help.txt shar-short-help.txt \
49	unshar-full-help.txt unshar-short-help.txt \
50	uudecode-full-help.txt uudecode-short-help.txt \
51	uuencode-full-help.txt uuencode-short-help.txt
52
53if AMDEP
54if UUCODE
55ENCODE_DEP_ARG  = -MF$(DEPDIR)/uuencode-opts.dep -MP -MT$@
56@am__include@ @am__quote@./$(DEPDIR)/uuencode-opts.dep@am__quote@
57
58DECODE_DEP_ARG  = -MF$(DEPDIR)/uudecode-opts.dep -MP -MT$@
59@am__include@ @am__quote@./$(DEPDIR)/uudecode-opts.dep@am__quote@
60endif
61# UUCODE
62
63SHAR_DEP_ARG  = -MF$(DEPDIR)/shar-opts.dep -MP
64@am__include@ @am__quote@./$(DEPDIR)/shar-opts.dep@am__quote@
65
66UNSHAR_DEP_ARG  = -MF$(DEPDIR)/unshar-opts.dep -MP
67@am__include@ @am__quote@./$(DEPDIR)/unshar-opts.dep@am__quote@
68
69else
70# AMDEP
71if UUCODE
72ENCODE_DEP_ARG  =
73DECODE_DEP_ARG  =
74endif
75# UUCODE
76SHAR_DEP_ARG    =
77UNSHAR_DEP_ARG  =
78endif
79# AMDEP
80
81if UUCODE
82  bin_PROGRAMS += uuencode uudecode
83  uuencode_LDADD = $(LDADD)
84  uudecode_LDADD = $(LDADD)
85endif
86
87EXTRA_SCRIPTS   = compress-dummy
88EXTRA_DIST      = scripts.def scripts.tpl $(options_defs) $(usage_texts)
89DISTCLEANFILES  = $(bin_SCRIPTS)
90
91localedir   = $(datadir)/locale
92
93AOINC       = -I$(top_srcdir)/libopts
94
95# `autoopts-config cflags`
96AM_CPPFLAGS = $(AOINC) -I$(srcdir) -I$(top_builddir) \
97	-I$(top_srcdir)/lib -I$(top_builddir)/lib -I$(top_builddir)/intl
98
99DEFS        = -DLOCALEDIR=\"$(localedir)\" @DEFS@
100
101# Source dependecies.
102
103if UUCODE
104uudecode_SOURCES = uudecode.c local.h $(decode_opt_code)
105uuencode_SOURCES = uuencode.c local.h $(encode_opt_code)
106
107if AMDEP
108uuencode-opts.c uuencode-opts.h : $(DEPDIR)/uuencode-opts.dep
109$(DEPDIR)/uuencode-opts.dep : uuencode-opts.def shar-std.def
110	$(AUTOGEN) $(ENCODE_DEP_ARG) uuencode-opts.def
111
112uudecode-opts.c uudecode-opts.h : $(DEPDIR)/uudecode-opts.dep
113$(DEPDIR)/uudecode-opts.dep : uudecode-opts.def shar-std.def
114	$(AUTOGEN) $(DECODE_DEP_ARG) uudecode-opts.def
115endif
116# AMDEP
117endif
118# UUCODE
119
120shar_SOURCES    = shar.c   local.h encode.c $(shar_extra) $(shar_opt_code)
121unshar_SOURCES  = unshar.c local.h encode.c $(unshar_opt_code)
122
123if AMDEP
124shar-opts.c shar-opts.h : $(DEPDIR)/shar-opts.dep
125$(DEPDIR)/shar-opts.dep : shar-opts.def shar-std.def
126	$(AUTOGEN) $(SHAR_DEP_ARG) shar-opts.def
127
128unshar-opts.c unshar-opts.h : $(DEPDIR)/unshar-opts.dep
129$(DEPDIR)/unshar-opts.dep : unshar-opts.def shar-std.def
130	$(AUTOGEN) $(UNSHAR_DEP_ARG) unshar-opts.def
131endif
132# AMDEP
133
134$(bin_PROGRAMS): $(top_builddir)/lib/libgnu.a
135
136install-exec-hook: $(INSTALL_COMPRESS_LINK)
137
138compress-link:
139	test -f $(DESTDIR)$(bindir)/compress-dummy \
140	  && ln -sf compress-dummy $(DESTDIR)$(bindir)/compress
141
142help-text : mk-help.sh $(bin_PROGRAMS)
143	touch $@
144	$(SHELL) mk-help.sh $@ $(bin_PROGRAMS)
145
146## src/Makefile.am ends here
147