configure: build-directory
@cd build-$(buildname); \
- build=$(build) $(SHELL) ../scripts/Configure-Makefile; \
- $(SHELL) ../scripts/lookups-Makefile
+ build=$(build) $(SHELL) ../scripts/Configure-Makefile
# The "makefile" target forces a rebuild of the makefile (as opposed to
# "configure", which doesn't force it).
makefile: build-directory
@cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
- build=$(build) $(SHELL) ../scripts/Configure-Makefile; \
- $(SHELL) ../scripts/lookups-Makefile
+ build=$(build) $(SHELL) ../scripts/Configure-Makefile
# The installation commands are kept in a separate script, which expects
# to be run from inside the build directory.
mft=$mf-t
mftt=$mf-tt
-look_mf=lookups/Makefile.predynamic
-look_mft=${look_mf}-t
+look_mf=lookups/Makefile
+look_mf_pre=${look_mf}.predynamic
+look_mf_post=${look_mf}.postdynamic
# Ensure the temporary does not exist and start the new one by setting
# the OSTYPE and ARCHTYPE variables.
rm -f $mftt
# make the lookups Makefile with the definitions
+# the auxiliary script generates $look_mf_post from $look_mf_pre
-## prepend stuff here; eg: grep LOOKUP_ $mft > $look_mft
-## cat ../src/lookups/Makefile >> $look_mft
-cp ../src/lookups/Makefile $look_mft
+cp ../src/lookups/Makefile $look_mf_pre
+../scripts/lookups-Makefile
# See if there is a definition of EXIM_PERL in what we have built so far.
# If so, run Perl to find the default values for PERL_CC, PERL_CCOPTS,
# If the new makefile is the same as the existing one, say so, and just
# update the timestamp. Otherwise remove the old and install the new.
-if [ -s $mf ] && cmp -s $mft $mf && [ -s $look_mf ] && cmp -s $look_mft $look_mf
+if [ -s $mf ] && cmp -s $mft $mf && [ -s $look_mf ] && cmp -s $look_mf_post $look_mf
then echo ">>> rebuilt $mf unchanged"
echo " "
touch $mf || exit
- rm -f $mft
-elif rm -f $mf $look_mf
+ rm -f $mft $look_mf_pre $look_mf_post
+elif rm -f $mf $look_mf $look_mf_pre
mv $mft $mf
- mv $look_mft $look_mf
+ mv $look_mf_post $look_mf
then echo ">>> New $mf & $look_mf installed"
echo '>>> Use "make makefile" if you need to force rebuilding of the makefile'
echo " "
fi
input=lookups/Makefile.predynamic
-target=lookups/Makefile
-defs_source=Makefile
+target=lookups/Makefile.postdynamic
+defs_source=Makefile-t
tag_marker='MAGIC-TAG-MODS-OBJ-RULES-GO-HERE'
tab=' '
# nb: do not permit leading whitespace for this, as CFLAGS_DYNAMIC is exported
# to the lookups subdir via a line with leading whitespace which otherwise
# matches
-if grep -q "^CFLAGS_DYNAMIC[ $tab]*=" "$defs_source"
+if grep -q "^CFLAGS_DYNAMIC[ $tab?:]*=" "$defs_source"
then
# we have a definition, we're good to go
+ echo >&2 ">>> Creating lookups/Makefile for building dynamic modules"
enable_dynamic=yes
else
- echo >&2 "Missing CFLAGS_DYNAMIC inhibits building dynamic module lookup"
+ echo >&2 ">>> Creating lookups/Makefile without dynamic module support"
enable_dynamic=''
# We always do something now, since there should always be a lookup,
# and now we need to run in order to put the OBJ=$(OBJ)+ rules in. So we
# continue on.
fi
-tmp="$target.t"
-
# For the want_ checks, we need to let the user override values from the make
# command-line, not just check the Makefile.
if want_dynamic "$lookup_name"
then
if [ -z "$enable_dynamic" ]; then
- echo >&2 "Inhibited dynamic modules prevents building dynamic $lookup_name"
+ echo >&2 "Missing CFLAGS_DYNAMIC prevents building dynamic $lookup_name"
exit 1
fi
MODS="${MODS} ${mod_name}.so"
fi
}
+rm -f "$target"
exec 5>&1
-exec > "$tmp"
+exec > "$target"
sed -n "1,/$tag_marker/p" < "$input"
sed -n "/$tag_marker/,\$p" < "$input"
exec >&5
-mv "$tmp" "$target"
+# Configure-Makefile will move $target into place
# vim: set ft=sh sw=2 :