|
@@ -45,8 +45,9 @@
|
|
|
# 2007-03-29 install-modules changed to use make -C modpath install (andrei)
|
|
|
# 2007-05-04 "if ! foo" not supported in standard sh, switched to
|
|
|
# "if foo; then :; else ... ; fi" (andrei)
|
|
|
-# 2008-06-23 added 2 new targets: README and man (re-generate the README
|
|
|
+# 2008-06-23 added 2 new targets: README and man (re-generate the README
|
|
|
# or manpages for all the modules) (andrei)
|
|
|
+# 2008-06-25 make cfg support (use a pre-built cfg.: config.mak) (andrei)
|
|
|
|
|
|
auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
|
|
|
auto_gen_others=cfg.tab.h # auto generated, non-c
|
|
@@ -183,6 +184,38 @@ endif
|
|
|
# the rest is excluded because it depends on external libraries
|
|
|
#
|
|
|
static_modules=
|
|
|
+
|
|
|
+ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
|
|
|
+
|
|
|
+#include general defs (like CC, CFLAGS a.s.o)
|
|
|
+# hack to force makefile.defs re-inclusion (needed when make calls itself with
|
|
|
+# other options -- e.g. make bin)
|
|
|
+#makefile_defs=0
|
|
|
+#DEFS:=
|
|
|
+
|
|
|
+
|
|
|
+# try saved cfg, unless we are in the process of building it
|
|
|
+ifeq (,$(filter config.mak config cfg,$(MAKECMDGOALS)))
|
|
|
+include config.mak
|
|
|
+ifeq ($(makefile_defs),1)
|
|
|
+$(info config.mak loaded)
|
|
|
+# config_make valid & used
|
|
|
+config_mak=1
|
|
|
+endif
|
|
|
+else
|
|
|
+ifneq (,$(filter cfg config,$(word 1,$(MAKECMDGOALS))))
|
|
|
+# needed here to avoid starting a config submake
|
|
|
+# (e.g. rm -f config.mak; make config.mak), which would either require
|
|
|
+# double Makefile.defs defines execution (suboptimal), would loose
|
|
|
+# $(value ...) expansion or would cause some warning (if Makefile.defs exec.
|
|
|
+# is skipped in the "main" makefile invocation).
|
|
|
+$(shell rm -rf config.mak)
|
|
|
+endif
|
|
|
+endif
|
|
|
+
|
|
|
+main_makefile=1
|
|
|
+include Makefile.defs
|
|
|
+
|
|
|
static_modules_path=$(addprefix modules/, $(static_modules))
|
|
|
extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
|
|
|
extra_objs=$(extra_sources:.c=.o)
|
|
@@ -197,24 +230,27 @@ export extra_defs
|
|
|
# include_modules
|
|
|
# When group_include is used, we want: include_modules (based on group_include)
|
|
|
# - exclude_modules
|
|
|
+
|
|
|
+ifneq ($(modules_configured),1)
|
|
|
ifneq ($(group_include),)
|
|
|
modules=$(filter-out $(addprefix modules/, \
|
|
|
$(exclude_modules) $(static_modules)), \
|
|
|
$(addprefix modules/, $(include_modules) ))
|
|
|
else
|
|
|
# Standard, old resultant set
|
|
|
- modules=$(filter-out $(addprefix modules/, \
|
|
|
- $(exclude_modules) $(static_modules)), \
|
|
|
- $(wildcard modules/*))
|
|
|
- modules:=$(filter-out $(modules), $(addprefix modules/, $(include_modules) )) \
|
|
|
- $(modules)
|
|
|
-endif
|
|
|
+ modules_all=$(filter-out CVS, $(wildcard modules/*))
|
|
|
+ modules_noinc=$(filter-out $(addprefix modules/, \
|
|
|
+ $(exclude_modules) $(static_modules)), $(modules_all))
|
|
|
+ modules=$(filter-out $(modules_noinc), \
|
|
|
+ $(addprefix modules/, $(include_modules) )) $(modules_noinc)
|
|
|
+endif # ifneq($(group_include),)
|
|
|
+endif # ifneq($(modules_configured),1)
|
|
|
modules_names=$(shell echo $(modules)| \
|
|
|
sed -e 's/modules\/\([^/ ]*\)\/*/\1.so/g' )
|
|
|
modules_basenames=$(shell echo $(modules)| \
|
|
|
sed -e 's/modules\/\([^/ ]*\)\/*/\1/g' )
|
|
|
#modules_names=$(patsubst modules/%, %.so, $(modules))
|
|
|
-modules_full_path=$(join $(modules), $(addprefix /, $(modules_names)))
|
|
|
+#modules_full_path=$(join $(modules), $(addprefix /, $(modules_names)))
|
|
|
|
|
|
|
|
|
# which utils need compilation (directory path) and which to install
|
|
@@ -230,14 +266,6 @@ share_install= scripts/mysql/my_create.sql \
|
|
|
scripts/mysql/my_drop.sql
|
|
|
|
|
|
|
|
|
-ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules
|
|
|
-
|
|
|
-#include general defs (like CC, CFLAGS a.s.o)
|
|
|
-# hack to force makefile.defs re-inclusion (needed when make calls itself with
|
|
|
-# other options -- e.g. make bin)
|
|
|
-makefile_defs=0
|
|
|
-DEFS:=
|
|
|
-include Makefile.defs
|
|
|
|
|
|
NAME=$(MAIN_NAME)
|
|
|
|
|
@@ -262,6 +290,7 @@ ifneq ($(TLS),)
|
|
|
endif
|
|
|
|
|
|
# include the common rules
|
|
|
+include Makefile.targets
|
|
|
include Makefile.rules
|
|
|
|
|
|
#extra targets
|
|
@@ -274,12 +303,50 @@ lex.yy.c: cfg.lex cfg.tab.h $(ALLDEP)
|
|
|
cfg.tab.c cfg.tab.h: cfg.y $(ALLDEP)
|
|
|
$(YACC) $(YACC_FLAGS) $<
|
|
|
|
|
|
+ifeq ($(config_mak),1)
|
|
|
+
|
|
|
+COREPATH=.
|
|
|
+include Makefile.cfg
|
|
|
+
|
|
|
+else
|
|
|
+include Makefile.shared
|
|
|
+
|
|
|
+config.mak: Makefile.defs
|
|
|
+ @echo making config...
|
|
|
+ @echo "# this file is autogenerated by make cfg" >$@
|
|
|
+ @echo "# `date`" >>$@
|
|
|
+ @$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
|
|
|
+ @$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
|
|
|
+ @echo "override makefile_defs:=1" >>$@
|
|
|
+ @$(call cfg_save_var2,group_include,$@)
|
|
|
+ @$(call cfg_save_var2,include_modules,$@)
|
|
|
+ @$(call cfg_save_var2,static_modules,$@)
|
|
|
+ @$(call cfg_save_var2,skip_modules,$@)
|
|
|
+ @$(call cfg_save_var2,exclude_modules,$@)
|
|
|
+ @$(call cfg_save_var2,modules_all,$@)
|
|
|
+ @$(call cfg_save_var2,modules_noinc,$@)
|
|
|
+ @$(call cfg_save_var2,modules,$@)
|
|
|
+ @echo "modules_configured:=1" >>$@
|
|
|
+ @echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
|
|
|
+ "\$$(extra_defs)" >>$@
|
|
|
+ @echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
|
|
|
+ "\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
|
|
|
+
|
|
|
+endif # ifeq ($(config_mak),1)
|
|
|
+
|
|
|
+.PHONY: cfg config
|
|
|
+cfg config: config.mak
|
|
|
+
|
|
|
+#rm -f config.mak
|
|
|
+#$(MAKE) config.mak exported_vars=0
|
|
|
+
|
|
|
.PHONY: all
|
|
|
all: $(NAME) modules
|
|
|
|
|
|
.PHONY: print-modules
|
|
|
print-modules:
|
|
|
- @echo The following modules was chosen to be included: $(include_modules) ; \
|
|
|
+ @echo The following modules were chosen to be included: \
|
|
|
+ $(include_modules) ; \
|
|
|
echo ---------------------------------------------------------- ; \
|
|
|
echo The following modules will be excluded: $(exclude_modules) ; \
|
|
|
echo ---------------------------------------------------------- ; \
|
|
@@ -349,6 +416,7 @@ tar:
|
|
|
--exclude=librpath.lst \
|
|
|
--exclude=libiname.lst \
|
|
|
--exclude=makecfg.lst \
|
|
|
+ --exclude=config.mak \
|
|
|
--exclude=*.[do] \
|
|
|
--exclude=*.so \
|
|
|
--exclude=*.il \
|
|
@@ -516,7 +584,6 @@ install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
|
|
|
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
|
|
|
$(INSTALL_BIN) $(NAME) $(bin_prefix)/$(bin_dir)
|
|
|
|
|
|
-export INSTALL_TOUCH RELEASE
|
|
|
|
|
|
install-share: $(share_prefix)/$(share_dir)
|
|
|
@for r in $(share_install) "" ; do \
|
|
@@ -638,3 +705,9 @@ clean_libs:
|
|
|
# cleaning in libs always when cleaning ser
|
|
|
clean: clean_libs
|
|
|
|
|
|
+proper realclean distclean: clean_cfg
|
|
|
+
|
|
|
+.PHONY: clean_cfg
|
|
|
+clean_cfg:
|
|
|
+ rm -f config.mak
|
|
|
+
|