From b0b8d60656e98fe0ec62aa91e71c067efc0dd6e2 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 4 Jul 2023 11:57:33 -0700 Subject: [PATCH] rename generated CONFIG_SITE to TOOLCHAIN No longer generate CONFIG_SITE.Common.$(T_A), which should never be generated... --- Makefile | 5 ++- bundle/Makefile | 2 ++ configure/CONFIG | 1 + configure/CONFIG_PVXS_MODULE | 41 ------------------------ configure/Makefile | 26 +++++++++++---- configure/toolchain.c | 2 +- example/Makefile | 5 --- ioc/Makefile | 5 --- qsrv/Makefile | 5 --- setup/CONFIG_PVXS_MODULE | 34 ++++++++++++++++++++ setup/Makefile | 44 ++++++++++++++++++++++++++ {configure => setup}/RULES_PVXS_MODULE | 2 +- setup/TOOLCHAIN_PVXS.target@ | 3 ++ src/Makefile | 9 ++---- test/Makefile | 5 --- tools/Makefile | 5 --- 16 files changed, 111 insertions(+), 83 deletions(-) delete mode 100644 configure/CONFIG_PVXS_MODULE create mode 100644 setup/CONFIG_PVXS_MODULE create mode 100644 setup/Makefile rename {configure => setup}/RULES_PVXS_MODULE (97%) create mode 100644 setup/TOOLCHAIN_PVXS.target@ diff --git a/Makefile b/Makefile index 5def74d..a9518df 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,11 @@ include $(TOP)/configure/CONFIG # Directories to build, any order DIRS += configure +DIRS += setup +setup_DEPEND_DIRS = configure + DIRS += src -src_DEPEND_DIRS = configure +src_DEPEND_DIRS = setup DIRS += tools tools_DEPEND_DIRS = src diff --git a/bundle/Makefile b/bundle/Makefile index 212c172..70438ab 100644 --- a/bundle/Makefile +++ b/bundle/Makefile @@ -1,5 +1,7 @@ TOP=.. +_PVXS_BOOTSTRAP = YES + include $(TOP)/configure/CONFIG CMAKE ?= cmake diff --git a/configure/CONFIG b/configure/CONFIG index c1a4703..adcbbdb 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -25,5 +25,6 @@ include $(TOP)/configure/CONFIG_SITE ifdef T_A -include $(TOP)/configure/CONFIG_SITE.Common.$(T_A) -include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) + -include $(TOP)/configure/O.$(T_A)/TOOLCHAIN endif diff --git a/configure/CONFIG_PVXS_MODULE b/configure/CONFIG_PVXS_MODULE deleted file mode 100644 index 3eda048..0000000 --- a/configure/CONFIG_PVXS_MODULE +++ /dev/null @@ -1,41 +0,0 @@ -# auto-compute location of this file. -# avoid need to standardize configure/RELEASE name -_PVXS := $(dir $(lastword $(MAKEFILE_LIST))) - -# we're appending so must be idempotent -ifeq (,$(_PVXS_CONF_INCLUDED)) -_PVXS_CONF_INCLUDED := YES - -ifdef T_A - -# use custom libevent2 install prefix by: -# setting LIBEVENT only for single arch build -# setting LIBEVENT_$(T_A) for each arch -# leave unset to use implicit system search path -# NOTE: only needed if not present in default search paths -LIBEVENT ?= $(LIBEVENT_$(T_A)) - -# default to bundled location if it exists -LIBEVENT_$(T_A) ?= $(wildcard $(abspath $(_PVXS)/../bundle/usr/$(T_A))) - -# apply to include search paths -INCLUDES += $(if $(LIBEVENT),-I$(LIBEVENT)/include) - -LIBEVENT_BUNDLE_LIBS += event_core -LIBEVENT_BUNDLE_LIBS_POSIX_YES = event_pthreads -LIBEVENT_BUNDLE_LIBS += $(LIBEVENT_BUNDLE_LIBS_POSIX_$(POSIX)) - -LIBEVENT_SYS_LIBS_WIN32 = bcrypt iphlpapi netapi32 ws2_32 -LIBEVENT_SYS_LIBS += $(LIBEVENT_SYS_LIBS_$(OS_CLASS)) - -LIBEVENT_BUNDLE_LDFLAGS_Darwin_NO = -Wl,-rpath,$(LIBEVENT)/lib -LIBEVENT_BUNDLE_LDFLAGS += $(LIBEVENT_BUNDLE_LDFLAGS_$(OS_CLASS)_$(STATIC_BUILD)) - -event_core_DIR = $(LIBEVENT)/lib -event_pthreads_DIR = $(LIBEVENT)/lib - -endif # T_A - -endif # _PVXS_CONF_INCLUDED - -# logic continues in RULES_PVXS_MODULE diff --git a/configure/Makefile b/configure/Makefile index 0e3ee92..e93b75c 100644 --- a/configure/Makefile +++ b/configure/Makefile @@ -1,22 +1,34 @@ TOP=.. +# step 1. Use -I... to test event-config.h +# produce configure/O.$(T_A)/TOOLCHAIN +# step 2 in setup/Makefile +_PVXS_BOOTSTRAP = YES + include $(TOP)/configure/CONFIG +# use custom libevent2 install prefix by: +# setting LIBEVENT only for single arch build +# setting LIBEVENT_$(T_A) for each arch +# leave unset to use implicit system search path +# NOTE: only needed if not present in default search paths +LIBEVENT ?= $(LIBEVENT_$(T_A)) +LIBEVENT_$(T_A) ?= $(wildcard $(abspath $(TOP)/bundle/usr/$(T_A))) + +INCLUDES += $(if $(LIBEVENT),-I$(LIBEVENT)/include) + TARGETS = $(CONFIG_TARGETS) CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS))) CFG += CONFIG_PVXS_VERSION -CFG += CONFIG_PVXS_MODULE -CFG += RULES_PVXS_MODULE include $(TOP)/configure/RULES ifdef T_A -install: $(TOP)/configure/CONFIG_SITE.Common.$(T_A) +install: TOOLCHAIN -$(TOP)/configure/CONFIG_SITE.Common.$(T_A): toolchain.c - $(PREPROCESS.cpp) - -CLEANS += ../CONFIG_SITE.Common.$(T_A) +TOOLCHAIN: toolchain.c + $(CPP) $(CPPFLAGS) $(INCLUDES) ../toolchain.c > $@.tmp + $(MV) $@.tmp $@ endif diff --git a/configure/toolchain.c b/configure/toolchain.c index f503a30..51792f2 100644 --- a/configure/toolchain.c +++ b/configure/toolchain.c @@ -1,7 +1,7 @@ #ifdef _COMMENT_ /* Compiler inspection * - * expanded as configure/CONFIG_SITE.Common.* + * expanded as configure/O.*/TOOLCHAIN */ /* GCC preprocessor drops C comments from output. * MSVC preprocessor emits C comments in output diff --git a/example/Makefile b/example/Makefile index 4478232..8e5a578 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,10 +1,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to a Base bug -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -35,7 +31,6 @@ rpc_client_SRCS += rpc_client.cpp #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/ioc/Makefile b/ioc/Makefile index 8366e9c..5cc7f5e 100644 --- a/ioc/Makefile +++ b/ioc/Makefile @@ -9,10 +9,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to an issue in epics-base -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -85,7 +81,6 @@ LIB_LIBS += $(EPICS_BASE_IOC_LIBS) #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/qsrv/Makefile b/qsrv/Makefile index 6faf927..03b3f1b 100644 --- a/qsrv/Makefile +++ b/qsrv/Makefile @@ -1,10 +1,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to a Base bug -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -31,7 +27,6 @@ FINAL_LOCATION ?= $(shell $(PERL) $(TOOLS)/fullPathName.pl $(INSTALL_LOCATION)) #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/setup/CONFIG_PVXS_MODULE b/setup/CONFIG_PVXS_MODULE new file mode 100644 index 0000000..df4be82 --- /dev/null +++ b/setup/CONFIG_PVXS_MODULE @@ -0,0 +1,34 @@ +# auto-compute location of this file. +# avoid need to standardize configure/RELEASE name +_PVXS := $(dir $(lastword $(MAKEFILE_LIST))) + +# we're appending so must be idempotent +ifeq (,$(_PVXS_CONF_INCLUDED)) +_PVXS_CONF_INCLUDED := YES + +ifdef T_A + +ifneq (YES,$(_PVXS_BOOTSTRAP)) +include $(_PVXS)/TOOLCHAIN_PVXS.$(T_A) +endif + +# from generated cfg/TOOLCHAIN_PVXS.$(T_A) +LIBEVENT_PREFIX = $(LIBEVENT_PREFIX_$(T_A)) +LIBEVENT_BUNDLE_LIBS = $(LIBEVENT_BUNDLE_LIBS_$(T_A)) +LIBEVENT_SYS_LIBS = $(LIBEVENT_SYS_LIBS_$(T_A)) + +# apply to include search paths +INCLUDES += $(if $(LIBEVENT_PREFIX),-I$(LIBEVENT_PREFIX)/include) + +LIBEVENT_BUNDLE_LDFLAGS__RPATH=-Wl,-rpath,$(LIBEVENT_PREFIX)/lib +LIBEVENT_BUNDLE_LDFLAGS_Darwin_NO = $(if $(LIBEVENT_PREFIX),$(LIBEVENT_BUNDLE_LDFLAGS__RPATH)) +LIBEVENT_BUNDLE_LDFLAGS += $(LIBEVENT_BUNDLE_LDFLAGS_$(OS_CLASS)_$(STATIC_BUILD)) + +event_core_DIR = $(LIBEVENT_PREFIX)/lib +event_pthreads_DIR = $(LIBEVENT_PREFIX)/lib + +endif # T_A + +endif # _PVXS_CONF_INCLUDED + +# logic continues in RULES_PVXS_MODULE diff --git a/setup/Makefile b/setup/Makefile new file mode 100644 index 0000000..02c696f --- /dev/null +++ b/setup/Makefile @@ -0,0 +1,44 @@ +TOP=.. + +# step 1 in configure/Makefile +# step 2. generate cfg/TOOLCHAIN_PVXS.$(T_A) +# install cfg/* +# remaining TOP directories will include generated files +_PVXS_BOOTSTRAP = YES + +include $(TOP)/configure/CONFIG + +LIBEVENT ?= $(LIBEVENT_$(T_A)) +LIBEVENT_$(T_A) ?= $(wildcard $(abspath $(TOP)/bundle/usr/$(T_A))) + +_LIBEVENT_BUNDLE_LIBS += event_core + +ifeq (WIN32,$(OS_CLASS)) +_LIBEVENT_SYS_LIBS += bcrypt iphlpapi netapi32 ws2_32 +else +_LIBEVENT_BUNDLE_LIBS += event_pthreads +endif + +# at this point we have included the generated O.$(T_A)/TOOLCHAIN +# and use this to generated CONFIG_PVXS_MODULE + +CFG += CONFIG_PVXS_MODULE +CFG += RULES_PVXS_MODULE + +ifdef T_A +CFG += TOOLCHAIN_PVXS.$(T_A) +endif + +include $(TOP)/configure/RULES + +ifdef T_A + +EXPAND_ARGS = -a $(T_A) -t "$(INSTALL_LOCATION)" +EXPAND_ARGS += "-DLIBEVENT=$(LIBEVENT)" +EXPAND_ARGS += "-DLIBEVENT_BUNDLE_LIBS=$(_LIBEVENT_BUNDLE_LIBS)" +EXPAND_ARGS += "-DLIBEVENT_SYS_LIBS=$(_LIBEVENT_SYS_LIBS)" + +TOOLCHAIN_PVXS.$(T_A): ../TOOLCHAIN_PVXS.target@ + $(EXPAND_TOOL) $(EXPAND_ARGS) $< $@ + +endif diff --git a/configure/RULES_PVXS_MODULE b/setup/RULES_PVXS_MODULE similarity index 97% rename from configure/RULES_PVXS_MODULE rename to setup/RULES_PVXS_MODULE index a373828..0348f5c 100644 --- a/configure/RULES_PVXS_MODULE +++ b/setup/RULES_PVXS_MODULE @@ -11,7 +11,7 @@ endif _PVXS_CHECK_VARS := PROD TESTPROD LIB $(PROD) $(TESTPROD) $(LIBRARY) -ifeq (,$(LIBEVENT)) +ifeq (,$(LIBEVENT_PREFIX)) # libevent in default search path # $(1) is PROD or LIBRARY name diff --git a/setup/TOOLCHAIN_PVXS.target@ b/setup/TOOLCHAIN_PVXS.target@ new file mode 100644 index 0000000..2dae3f2 --- /dev/null +++ b/setup/TOOLCHAIN_PVXS.target@ @@ -0,0 +1,3 @@ +LIBEVENT_PREFIX_@ARCH@ = @LIBEVENT@ +LIBEVENT_BUNDLE_LIBS_@ARCH@ = @LIBEVENT_BUNDLE_LIBS@ +LIBEVENT_SYS_LIBS_@ARCH@ = @LIBEVENT_SYS_LIBS@ diff --git a/src/Makefile b/src/Makefile index 4a885d5..d062f46 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to a Base bug -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -14,7 +10,7 @@ USR_CPPFLAGS += -DPVXS_ENABLE_EXPERT_API ifdef T_A ifneq ($(CONFIG_LOADED),YES) -$(error Toolchain inspection failed $(MAKEFILE_LIST)) +$(warning Toolchain inspection failed $(MAKEFILE_LIST)) endif endif @@ -111,7 +107,7 @@ LIB_SRCS += clientdiscover.cpp LIB_LIBS += Com # special case matching configure/RULES_PVXS_MODULE -ifeq (,$(LIBEVENT)) +ifeq (,$(LIBEVENT_PREFIX)) LIB_SYS_LIBS += $(LIBEVENT_BUNDLE_LIBS) else LIB_LIBS += $(LIBEVENT_BUNDLE_LIBS) @@ -122,7 +118,6 @@ LIB_SYS_LIBS += $(LIBEVENT_SYS_LIBS) #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/test/Makefile b/test/Makefile index cac1829..d26f935 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,10 +1,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to a Base bug -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -191,7 +187,6 @@ endif #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/tools/Makefile b/tools/Makefile index 4e3eef4..18785fc 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,10 +1,6 @@ TOP=.. include $(TOP)/configure/CONFIG -# cfg/ sometimes isn't correctly included due to a Base bug -# so we do here (maybe again) as workaround -include $(TOP)/configure/CONFIG_PVXS_MODULE -include $(TOP)/configure/CONFIG_PVXS_VERSION #---------------------------------------- # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= @@ -41,7 +37,6 @@ pvxmshim_SRCS += mshim.cpp #=========================== include $(TOP)/configure/RULES -include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE