1#ident @(#)rules.cnf	1.25 21/07/14
2###########################################################################
3# Written 1998-2021 by J. Schilling
4###########################################################################
5#
6# Make Rules for global dynamic configuration
7#
8###########################################################################
9# Copyright (c) J. Schilling
10###########################################################################
11# The contents of this file are subject to the terms of the
12# Common Development and Distribution License, Version 1.0 only
13# (the "License").  You may not use this file except in compliance
14# with the License.
15#
16# See the file CDDL.Schily.txt in this distribution for details.
17# A copy of the CDDL is also available via the Internet at
18# http://www.opensource.org/licenses/cddl1.txt
19#
20# When distributing Covered Code, include this CDDL HEADER in each
21# file and include the License file CDDL.Schily.txt from this distribution.
22###########################################################################
23
24$(SRCROOT)/autoconf/configure: $(SRCROOT)/autoconf/autoconf.m4 \
25				$(SRCROOT)/autoconf/acgeneral.m4 \
26				$(SRCROOT)/autoconf/acspecific.m4 \
27				$(SRCROOT)/autoconf/acoldnames.m4 \
28				$(SRCROOT)/autoconf/aclocal.m4 \
29				$(SRCROOT)/autoconf/rules.cnf.in \
30				$(SRCROOT)/autoconf/xconfig.h.in
31	$(NOECHO)echo "	==> AUTOCONFIGURING GLOBAL \"$@\""; \
32	cd $(SRCROOT)/autoconf && sh ./autoconf
33
34config: $(OINCSDIR)/rules.cnf
35
36$(OINCSDIR)/Inull:
37	$(MKDIR) -p $(OINCSDIR)
38	$(NOECHO)echo > $@
39
40$(OINCSDIR):
41	$(MKDIR) -p $@
42
43#
44# Hack until the <mach>-<os>-*cc.rul files are updated
45#
46_HCC_COM=	$(OARCH:%-gcc=gcc)
47HCC_COM=	$(_HCC_COM:%-cc=cc)
48
49_XCC_COM=	$(_UNIQ)$(CC_COM)
50__XCC_COM=	$(_XCC_COM:$(_UNIQ)=$(HCC_COM))
51XCC_COM=	$(__XCC_COM:$(_UNIQ)%=%)
52
53#CONFFLAGS +=	-cc=$(XCC_COM)
54
55###########################################################################
56# Since the linker on z/OS complains about missing dirs if -L<missing>
57# was specified, we create $(OLIBSDIR) here, in order to have it present
58# at startup already.
59###########################################################################
60$(OINCSDIR)/rules.cnf $(OINCSDIR)/xconfig.h: $(OINCSDIR)/Inull \
61					$(SRCROOT)/autoconf/configure \
62					$(SRCROOT)/autoconf/rules.cnf.in \
63					$(SRCROOT)/autoconf/xconfig.h.in
64	$(NOECHO)echo "	==> MAKING DIRECTORY \"$(OLIBSDIR)\""; $(_MKDIR) -p $(OLIBSDIR)
65	$(RUL_CONF)
66
67###########################################################################
68# We used LDFLAGS="$(LDOPTS)" since 2007, but the z/OS compiler does not
69# like -L /dir with a not yet existing directrory. We then did pass LDFLAGS=""
70# but this results in wrong configure results on FreeBSD if -L/usr/local/lib
71# is needed. Now configure uses a different link command line on OS/390.
72###########################################################################
73OS_DEFS=	$(OSINCDIRS:%=-I%) $(OSDEFS) $(OSDEFSX)
74RUL_CONF=	$(NOECHO)echo "	==> CONFIGURING RULES \"$@\""; \
75		$(RM_F) $(OINCSDIR)/rules.cnf $(OINCSDIR)/xconfig.h; \
76		(cd $(OINCSDIR); \
77		CONFIG_NOFAIL=TRUE CC="$(XCC_COM)" CFLAGS="$(C_FLAGS) $(CFLAGS)" \
78		CXXFLAGS="$(C++FLAGS)" CPPFLAGS="$(OS_DEFS) $(CPPFLAGS)" \
79		LDFLAGS="$(LDOPTS:%$(OLIBSDIR)=%../../$(OLIBSDIRR))" \
80		CONFIG_SHELL=$(SHELL) \
81		$(SHELL) ../../autoconf/configure $(CONFFLAGS) ); \
82		([ -d  $(SRCROOT)/inc ] && cd $(SRCROOT)/inc && $(MAKE) || :)
83###########################################################################
84include $(OINCSDIR)/Inull
85include $(OINCSDIR)/rules.cnf
86###########################################################################
87include	$(SRCROOT)/$(RULESDIR)/$(LOCAL_CNF)
88