1############################################################
2## config/post.in
3##
4
5# in case there is no default target (very unlikely)
6all:
7
8check-windows:
9
10# In a few parts of "make check" we run shell scripts which run
11# programs linked against krb5 libraries.  On macOS 10.11 and higher,
12# DYLD_LIBRARY_PATH is cleared by the shell unless System Integrity
13# Protection is turned off, so we need to set runtime linker
14# environment variables from within test scripts.  A Makefile.in which
15# runs shell script tests should make its check rule depend on
16# runenv.sh and make each script begin with ". ./runenv.sh".
17runenv.sh:
18	$(RUN_SETUP); for i in $(RUN_VARS); do \
19		eval echo "$$i=\\\"\$$$$i\\\""; \
20		echo "export $$i"; done > $@
21
22##############################
23# dependency generation
24#
25
26depend: depend-postrecurse
27depend-postrecurse: depend-recurse
28depend-recurse: depend-prerecurse
29
30depend-prerecurse:
31depend-postrecurse:
32
33depend-postrecurse: depend-update-makefile
34
35ALL_DEP_SRCS= $(SRCS) $(EXTRADEPSRCS)
36
37# be sure to check ALL_DEP_SRCS against *what it would be if SRCS and
38# EXTRADEPSRCS are both empty*
39$(BUILDTOP)/.depend-verify-srcdir:
40	@if test "$(srcdir)" = "." ; then \
41		echo 1>&2 error: cannot build dependencies with srcdir=. ; \
42		echo 1>&2 "(can't distinguish generated files from source files)" ; \
43		echo 1>&2 "Run 'make distclean' and create a separate build dir" ; \
44		exit 1 ; \
45	elif test -f "$(top_srcdir)/include/autoconf.h"; then \
46		echo 1>&2 "error: generated headers found in source tree" ; \
47		echo 1>&2 "Run 'make distclean' in source tree first" ; \
48		exit 1 ; \
49	else \
50		if test -r $(BUILDTOP)/.depend-verify-srcdir; then :; \
51			else (set -x; touch $(BUILDTOP)/.depend-verify-srcdir); fi \
52	fi
53$(BUILDTOP)/.depend-verify-et: depend-verify-et-$(COM_ERR_VERSION)
54depend-verify-et-k5:
55	@if test -r $(BUILDTOP)/.depend-verify-et; then :; \
56		else (set -x; touch $(BUILDTOP)/.depend-verify-et); fi
57depend-verify-et-sys depend-verify-et-intlsys:
58	@echo 1>&2 error: cannot build dependencies using system et package
59	@exit 1
60$(BUILDTOP)/.depend-verify-ss: depend-verify-ss-$(SS_VERSION)
61depend-verify-ss-k5:
62	@if test -r $(BUILDTOP)/.depend-verify-ss; then :; \
63		else (set -x; touch $(BUILDTOP)/.depend-verify-ss); fi
64depend-verify-ss-sys:
65	@echo 1>&2 error: cannot build dependencies using system ss package
66	@exit 1
67$(BUILDTOP)/.depend-verify-verto: depend-verify-verto-$(VERTO_VERSION)
68depend-verify-verto-k5:
69	@if test -r $(BUILDTOP)/.depend-verify-verto; then :; \
70		else (set -x; touch $(BUILDTOP)/.depend-verify-verto); fi
71depend-verify-verto-sys:
72	@echo 1>&2 error: cannot build dependencies using system verto package
73	@echo 1>&2 Please configure with --without-system-verto
74	@exit 1
75$(BUILDTOP)/.depend-verify-gcc: depend-verify-gcc-@HAVE_GCC@
76depend-verify-gcc-yes:
77	@if test -r $(BUILDTOP)/.depend-verify-gcc; then :; \
78		else (set -x; touch $(BUILDTOP)/.depend-verify-gcc); fi
79depend-verify-gcc-no:
80	@echo 1>&2 error: The '"depend"' rules are written for gcc.
81	@echo 1>&2 Please use gcc, or update the rules to handle your compiler.
82	@exit 1
83
84DEP_CFG_VERIFY = $(BUILDTOP)/.depend-verify-srcdir \
85	$(BUILDTOP)/.depend-verify-et $(BUILDTOP)/.depend-verify-ss \
86	$(BUILDTOP)/.depend-verify-verto
87DEP_VERIFY = $(DEP_CFG_VERIFY) $(BUILDTOP)/.depend-verify-gcc
88
89.d: $(ALL_DEP_SRCS) $(DEP_CFG_VERIFY) depend-dependencies
90	if test "$(ALL_DEP_SRCS)" != " " ; then \
91		$(RM) .dtmp && $(MAKE) .dtmp && mv -f .dtmp .d ; \
92	else \
93		touch .d ; \
94	fi
95
96# These are dependencies of the depend target that do not get fed to
97# the compiler.  Examples include generated header files.
98depend-dependencies:
99
100# .dtmp must *always* be out of date so that $? can be used to perform
101# VPATH searches on the sources.
102#
103# NOTE: This will fail when using Make programs whose VPATH support is
104# broken.
105.dtmp: $(ALL_DEP_SRCS)
106	$(CC) -M -DDEPEND $(ALL_CFLAGS) $? > .dtmp
107
108# NOTE: This will also generate spurious $(OUTPRE) and $(OBJEXT)
109# references in rules for non-library objects in a directory where
110# library objects happen to be built.  It's mostly harmless.
111.depend: .d $(top_srcdir)/util/depfix.pl
112	perl $(top_srcdir)/util/depfix.pl '$(top_srcdir)' '$(mydir)' \
113		'$(srcdir)' '$(BUILDTOP)' '$(STLIBOBJS)' < .d > .depend
114
115# Temporarily keep the rule for removing the dependency line eater
116# until we're sure we've gotten everything converted and excised the
117# old stuff from Makefile.in files.
118depend-update-makefile: .depend depend-recurse
119	if test "$(ALL_DEP_SRCS)" != " " ; then \
120		$(CP) .depend $(srcdir)/deps.new ; \
121	else \
122		echo "# No dependencies here." > $(srcdir)/deps.new ; \
123	fi
124	$(top_srcdir)/config/move-if-changed $(srcdir)/deps.new $(srcdir)/deps
125	sed -e '/^# +++ Dependency line eater +++/,$$d' \
126		< $(srcdir)/Makefile.in > $(srcdir)/Makefile.in.new
127	$(top_srcdir)/config/move-if-changed $(srcdir)/Makefile.in.new \
128		$(srcdir)/Makefile.in
129
130DEPTARGETS = .depend .d .dtmp $(DEP_VERIFY)
131DEPTARGETS_CLEAN = .depend .d .dtmp $(DEPTARGETS_@srcdir@_@CONFIG_RELTOPDIR@)
132DEPTARGETS_@top_srcdir@_. = $(DEP_VERIFY)
133
134# Clear out dependencies.  Should only be used temporarily, e.g., while
135# moving or renaming headers and then rebuilding dependencies.
136undepend: undepend-postrecurse
137undepend-recurse:
138undepend-postrecurse: undepend-recurse
139	if test -n "$(SRCS)" ; then \
140		sed -e '/^# +++ Dependency line eater +++/,$$d' \
141			< $(srcdir)/Makefile.in \
142			> $(srcdir)/Makefile.in.new ;\
143		echo "# +++ Dependency line eater +++" >> $(srcdir)/Makefile.in.new ;\
144		echo "# (dependencies temporarily removed)" >> $(srcdir)/Makefile.in.new ;\
145		$(top_srcdir)/config/move-if-changed $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in;\
146	else :; fi
147
148#
149# end dependency generation
150##############################
151
152# Python tests
153check-unix: check-pytests-@HAVE_PYTHON@
154
155# Makefile.in should add rules to check-pytests to execute Python tests.
156check-pytests-yes: check-pytests
157check-pytests-no:
158check-pytests:
159
160# cmocka tests
161check-unix: check-cmocka-@HAVE_CMOCKA@
162
163check-cmocka-yes: check-cmocka
164check-cmocka-no:
165check-cmocka:
166
167clean: clean-$(WHAT)
168
169clean-unix::
170	$(RM) $(OBJS) $(DEPTARGETS_CLEAN) $(EXTRA_FILES)
171	$(RM) et-[ch]-*.et et-[ch]-*.[ch] testlog testtrace runenv.sh
172	-$(RM) -r testdir
173
174clean-windows::
175	$(RM) *.$(OBJEXT)
176	$(RM) msvc.pdb *.err
177
178distclean: distclean-$(WHAT)
179
180distclean-normal-clean:
181	$(MAKE) NORECURSE=true clean
182distclean-prerecurse: distclean-normal-clean
183distclean-nuke-configure-state:
184	$(RM) config.log config.cache config.status Makefile
185distclean-postrecurse: distclean-nuke-configure-state
186
187Makefiles-prerecurse: Makefile
188
189# mydir = relative path from top to this Makefile
190Makefile: $(srcdir)/Makefile.in $(srcdir)/deps $(BUILDTOP)/config.status \
191		$(top_srcdir)/config/pre.in $(top_srcdir)/config/post.in
192	(cd $(BUILDTOP) && $(SHELL) config.status $(mydir)/Makefile)
193$(BUILDTOP)/config.status: $(top_srcdir)/configure
194	(cd $(BUILDTOP) && $(SHELL) config.status --recheck)
195$(top_srcdir)/configure: @MAINT@ \
196		$(top_srcdir)/configure.ac \
197		$(top_srcdir)/patchlevel.h \
198		$(top_srcdir)/aclocal.m4
199	(cd $(top_srcdir) && \
200		$(AUTOCONF) -f --include=$(CONFIG_RELTOPDIR) $(AUTOCONFFLAGS))
201
202RECURSE_TARGETS=all-recurse clean-recurse distclean-recurse install-recurse \
203	generate-files-mac-recurse \
204	check-recurse depend-recurse undepend-recurse \
205	Makefiles-recurse install-headers-recurse
206
207# MY_SUBDIRS overrides any setting of SUBDIRS generated by the
208# configure script that generated this Makefile.  This is needed when
209# the configure script that produced this Makefile creates multiple
210# Makefiles in different directories; the setting of SUBDIRS will be
211# the same in each.
212#
213# LOCAL_SUBDIRS seems to account for the case where the configure
214# script doesn't call any other subsidiary configure scripts, but
215# generates multiple Makefiles.
216$(RECURSE_TARGETS):
217	@case "`echo 'x$(MFLAGS)'|sed -e 's/^x//' -e 's/ --.*$$//'`" \
218		in *[ik]*) e="status=1" ;; *) e="exit 1";; esac; \
219	do_subdirs="$(SUBDIRS)" ; \
220	status=0; \
221	if test -n "$$do_subdirs" && test -z "$(NORECURSE)"; then \
222	for i in $$do_subdirs ; do \
223		if test -d $$i && test -r $$i/Makefile ; then \
224		case $$i in .);; *) \
225			target=`echo $@|sed s/-recurse//`; \
226			echo "making $$target in $(CURRENT_DIR)$$i..."; \
227			if (cd $$i ; $(MAKE) \
228			    CURRENT_DIR=$(CURRENT_DIR)$$i/ $$target) then :; \
229			else eval $$e; fi; \
230			;; \
231		esac; \
232		else \
233			echo "Skipping missing directory $(CURRENT_DIR)$$i" ; \
234		fi; \
235	done; \
236	else :; \
237	fi;\
238	exit $$status
239
240##
241## end of post.in
242############################################################
243