From 5009f288ae9777484eb62ce3f3be4331e71e6148 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2020 11:42:44 -0500 Subject: [PATCH] Generate module version files with new RULES_EXPAND facilities Also removes the separate *VersionNum.h@ templates --- modules/ca/src/client/Makefile | 21 +++++---------- .../src/client/{caVersion.h => caVersion.h@} | 15 +++++------ modules/ca/src/client/caVersionNum.h@ | 7 ----- modules/database/src/ioc/Makefile | 22 +++++---------- .../{databaseVersion.h => databaseVersion.h@} | 26 +++++++----------- .../database/src/ioc/databaseVersionNum.h@ | 7 ----- modules/database/test/std/rec/dbHeaderTest.c | 5 +--- modules/libcom/src/Makefile | 20 +++++--------- .../src/{libComVersion.h => libComVersion.h@} | 27 +++++++------------ modules/libcom/src/libComVersionNum.h@ | 7 ----- 10 files changed, 48 insertions(+), 109 deletions(-) rename modules/ca/src/client/{caVersion.h => caVersion.h@} (68%) delete mode 100644 modules/ca/src/client/caVersionNum.h@ rename modules/database/src/ioc/{databaseVersion.h => databaseVersion.h@} (50%) delete mode 100644 modules/database/src/ioc/databaseVersionNum.h@ rename modules/libcom/src/{libComVersion.h => libComVersion.h@} (50%) delete mode 100644 modules/libcom/src/libComVersionNum.h@ diff --git a/modules/ca/src/client/Makefile b/modules/ca/src/client/Makefile index 57d113e6b..5b5874aee 100644 --- a/modules/ca/src/client/Makefile +++ b/modules/ca/src/client/Makefile @@ -26,7 +26,13 @@ INC += cacIO.h INC += caDiagnostics.h INC += net_convert.h INC += caVersion.h -INC += caVersionNum.h + +EXPAND_COMMON += caVersion.h@ + +EXPAND_ME += EPICS_CA_MAJOR_VERSION +EXPAND_ME += EPICS_CA_MINOR_VERSION +EXPAND_ME += EPICS_CA_MAINTENANCE_VERSION +EXPAND_ME += EPICS_CA_DEVELOPMENT_FLAG LIBSRCS += cac.cpp LIBSRCS += cacChannel.cpp @@ -120,20 +126,7 @@ ca_test_SYS_LIBS_WIN32 = ws2_32 advapi32 user32 OBJS_vxWorks += ca_test -EXPANDVARS += EPICS_CA_MAJOR_VERSION -EXPANDVARS += EPICS_CA_MINOR_VERSION -EXPANDVARS += EPICS_CA_MAINTENANCE_VERSION -EXPANDVARS += EPICS_CA_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - # shared library ABI version. SHRLIB_VERSION = $(EPICS_CA_MAJOR_VERSION).$(EPICS_CA_MINOR_VERSION).$(EPICS_CA_MAINTENANCE_VERSION) include $(TOP)/configure/RULES - - -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/caVersionNum.h: ../caVersionNum.h@ - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ diff --git a/modules/ca/src/client/caVersion.h b/modules/ca/src/client/caVersion.h@ similarity index 68% rename from modules/ca/src/client/caVersion.h rename to modules/ca/src/client/caVersion.h@ index 9dda32c60..f9225c53a 100644 --- a/modules/ca/src/client/caVersion.h +++ b/modules/ca/src/client/caVersion.h@ @@ -8,17 +8,14 @@ #ifndef INC_caVersion_H #define INC_caVersion_H -#include +#define EPICS_CA_MAJOR_VERSION @EPICS_CA_MAJOR_VERSION@ +#define EPICS_CA_MINOR_VERSION @EPICS_CA_MINOR_VERSION@ +#define EPICS_CA_MAINTENANCE_VERSION @EPICS_CA_MAINTENANCE_VERSION@ +#define EPICS_CA_DEVELOPMENT_FLAG @EPICS_CA_DEVELOPMENT_FLAG@ -/* include generated headers with: - * EPICS_CA_MAJOR_VERSION - * EPICS_CA_MINOR_VERSION - * EPICS_CA_MAINTENANCE_VERSION - * EPICS_CA_DEVELOPMENT_FLAG - */ -#include "caVersionNum.h" +#include #define CA_VERSION_INT VERSION_INT(EPICS_CA_MAJOR_VERSION, \ EPICS_CA_MINOR_VERSION, EPICS_CA_MAINTENANCE_VERSION, 0) -#endif /* ifndef INC_caVersion_H */ +#endif /* INC_caVersion_H */ diff --git a/modules/ca/src/client/caVersionNum.h@ b/modules/ca/src/client/caVersionNum.h@ deleted file mode 100644 index dcd7518c0..000000000 --- a/modules/ca/src/client/caVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef INC_caVersion_H -# error include caVersion.h, not this header -#endif -#define EPICS_CA_MAJOR_VERSION @EPICS_CA_MAJOR_VERSION@ -#define EPICS_CA_MINOR_VERSION @EPICS_CA_MINOR_VERSION@ -#define EPICS_CA_MAINTENANCE_VERSION @EPICS_CA_MAINTENANCE_VERSION@ -#define EPICS_CA_DEVELOPMENT_FLAG @EPICS_CA_DEVELOPMENT_FLAG@ diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 23c9c02b6..503208862 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -23,10 +23,15 @@ dbCore_LIBS += ca Com dbCore_SYS_LIBS_WIN32 += ws2_32 dbCore_RCS += dbCore.rc -dbStaticHost_RCS = dbStaticHost.rc + +EXPAND_COMMON += databaseVersion.h@ + +EXPAND_ME += EPICS_DATABASE_MAJOR_VERSION +EXPAND_ME += EPICS_DATABASE_MINOR_VERSION +EXPAND_ME += EPICS_DATABASE_MAINTENANCE_VERSION +EXPAND_ME += EPICS_DATABASE_DEVELOPMENT_FLAG INC += databaseVersion.h -INC += databaseVersionNum.h PROD_LIBS = Com @@ -42,13 +47,6 @@ include $(IOCDIR)/rsrv/Makefile GENVERSION = epicsVCS.h GENVERSIONMACRO = EPICS_VCS_VERSION -EXPANDVARS += EPICS_DATABASE_MAJOR_VERSION -EXPANDVARS += EPICS_DATABASE_MINOR_VERSION -EXPANDVARS += EPICS_DATABASE_MAINTENANCE_VERSION -EXPANDVARS += EPICS_DATABASE_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - include $(TOP)/configure/RULES include $(IOCDIR)/dbStatic/RULES @@ -56,10 +54,4 @@ include $(IOCDIR)/bpt/RULES include $(IOCDIR)/db/RULES include $(IOCDIR)/dbtemplate/RULES -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/databaseVersionNum.h: ../databaseVersionNum.h@ - $(MKDIR) $(COMMON_DIR) - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ - epicsRelease$(DEP): $(COMMON_DIR)/$(GENVERSION) diff --git a/modules/database/src/ioc/databaseVersion.h b/modules/database/src/ioc/databaseVersion.h@ similarity index 50% rename from modules/database/src/ioc/databaseVersion.h rename to modules/database/src/ioc/databaseVersion.h@ index eb5e4d732..efd837b26 100644 --- a/modules/database/src/ioc/databaseVersion.h +++ b/modules/database/src/ioc/databaseVersion.h@ @@ -5,23 +5,17 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef DATABASEVERSION_H -#define DATABASEVERSION_H +#ifndef INC_databaseVersion_H +#define INC_databaseVersion_H + +#define EPICS_DATABASE_MAJOR_VERSION @EPICS_DATABASE_MAJOR_VERSION@ +#define EPICS_DATABASE_MINOR_VERSION @EPICS_DATABASE_MINOR_VERSION@ +#define EPICS_DATABASE_MAINTENANCE_VERSION @EPICS_DATABASE_MAINTENANCE_VERSION@ +#define EPICS_DATABASE_DEVELOPMENT_FLAG @EPICS_DATABASE_DEVELOPMENT_FLAG@ #include -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif +#define DATABASE_VERSION_INT VERSION_INT(EPICS_DATABASE_MAJOR_VERSION, \ + EPICS_DATABASE_MINOR_VERSION, EPICS_DATABASE_MAINTENANCE_VERSION, 0) -/* include generated headers with: - * EPICS_DATABASE_MAJOR_VERSION - * EPICS_DATABASE_MINOR_VERSION - * EPICS_DATABASE_MAINTENANCE_VERSION - * EPICS_DATABASE_DEVELOPMENT_FLAG - */ -#include "databaseVersionNum.h" - -#define DATABASE_VERSION_INT VERSION_INT(EPICS_DATABASE_MAJOR_VERSION, EPICS_DATABASE_MINOR_VERSION, EPICS_DATABASE_MAINTENANCE_VERSION, 0) - -#endif // DATABASEVERSION_H +#endif /* INC_databaseVersion_H */ diff --git a/modules/database/src/ioc/databaseVersionNum.h@ b/modules/database/src/ioc/databaseVersionNum.h@ deleted file mode 100644 index 02184a81b..000000000 --- a/modules/database/src/ioc/databaseVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef DATABASEVERSION_H -# error include databaseVersion.h, not this header -#endif -#define EPICS_DATABASE_MAJOR_VERSION @EPICS_DATABASE_MAJOR_VERSION@ -#define EPICS_DATABASE_MINOR_VERSION @EPICS_DATABASE_MINOR_VERSION@ -#define EPICS_DATABASE_MAINTENANCE_VERSION @EPICS_DATABASE_MAINTENANCE_VERSION@ -#define EPICS_DATABASE_DEVELOPMENT_FLAG @EPICS_DATABASE_DEVELOPMENT_FLAG@ diff --git a/modules/database/test/std/rec/dbHeaderTest.c b/modules/database/test/std/rec/dbHeaderTest.c index 0e2785a8f..a88e2213b 100644 --- a/modules/database/test/std/rec/dbHeaderTest.c +++ b/modules/database/test/std/rec/dbHeaderTest.c @@ -5,7 +5,7 @@ \*************************************************************************/ /* This test includes all public headers from libCom and database modules - * to ensure they are all syntaxtically correct in C and C++ + * to ensure they are all syntaxtically correct in both C and C++ */ #include @@ -31,14 +31,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -152,7 +150,6 @@ #endif #include #include -#include #include #ifdef __cplusplus # include diff --git a/modules/libcom/src/Makefile b/modules/libcom/src/Makefile index f90fde6a6..ffc36445e 100644 --- a/modules/libcom/src/Makefile +++ b/modules/libcom/src/Makefile @@ -16,8 +16,14 @@ include $(TOP)/configure/CONFIG INC += valgrind/valgrind.h +EXPAND_COMMON = libComVersion.h@ + +EXPAND_ME += EPICS_LIBCOM_MAJOR_VERSION +EXPAND_ME += EPICS_LIBCOM_MINOR_VERSION +EXPAND_ME += EPICS_LIBCOM_MAINTENANCE_VERSION +EXPAND_ME += EPICS_LIBCOM_DEVELOPMENT_FLAG + INC += libComVersion.h -INC += libComVersionNum.h include $(LIBCOM)/as/Makefile include $(LIBCOM)/bucketLib/Makefile @@ -61,13 +67,6 @@ ifeq ($(T_A),$(EPICS_HOST_ARCH)) DELAY_INSTALL_LIBS = YES endif -EXPANDVARS += EPICS_LIBCOM_MAJOR_VERSION -EXPANDVARS += EPICS_LIBCOM_MINOR_VERSION -EXPANDVARS += EPICS_LIBCOM_MAINTENANCE_VERSION -EXPANDVARS += EPICS_LIBCOM_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - # shared library ABI version. SHRLIB_VERSION = $(EPICS_LIBCOM_MAJOR_VERSION).$(EPICS_LIBCOM_MINOR_VERSION).$(EPICS_LIBCOM_MAINTENANCE_VERSION) @@ -80,8 +79,3 @@ include $(LIBCOM)/flex/RULES include $(LIBCOM)/misc/RULES include $(LIBCOM)/osi/RULES include $(LIBCOM)/yajl/RULES - -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/libComVersionNum.h: ../libComVersionNum.h@ - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ diff --git a/modules/libcom/src/libComVersion.h b/modules/libcom/src/libComVersion.h@ similarity index 50% rename from modules/libcom/src/libComVersion.h rename to modules/libcom/src/libComVersion.h@ index 60537f9c2..0db39b142 100644 --- a/modules/libcom/src/libComVersion.h +++ b/modules/libcom/src/libComVersion.h@ @@ -5,24 +5,17 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef LIBCOMVERSION_H -#define LIBCOMVERSION_H +#ifndef INC_libComVersion_H +#define INC_libComVersion_H + +#define EPICS_LIBCOM_MAJOR_VERSION @EPICS_LIBCOM_MAJOR_VERSION@ +#define EPICS_LIBCOM_MINOR_VERSION @EPICS_LIBCOM_MINOR_VERSION@ +#define EPICS_LIBCOM_MAINTENANCE_VERSION @EPICS_LIBCOM_MAINTENANCE_VERSION@ +#define EPICS_LIBCOM_DEVELOPMENT_FLAG @EPICS_LIBCOM_DEVELOPMENT_FLAG@ #include -#include -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif +#define LIBCOM_VERSION_INT VERSION_INT(EPICS_LIBCOM_MAJOR_VERSION, \ + EPICS_LIBCOM_MINOR_VERSION, EPICS_LIBCOM_MAINTENANCE_VERSION, 0) -/* include generated headers with: - * EPICS_LIBCOM_MAJOR_VERSION - * EPICS_LIBCOM_MINOR_VERSION - * EPICS_LIBCOM_MAINTENANCE_VERSION - * EPICS_LIBCOM_DEVELOPMENT_FLAG - */ -#include "libComVersionNum.h" - -#define LIBCOM_VERSION_INT VERSION_INT(EPICS_LIBCOM_MAJOR_VERSION, EPICS_LIBCOM_MINOR_VERSION, EPICS_LIBCOM_MAINTENANCE_VERSION, 0) - -#endif // LIBCOMVERSION_H +#endif /* INC_libComVersion_H */ diff --git a/modules/libcom/src/libComVersionNum.h@ b/modules/libcom/src/libComVersionNum.h@ deleted file mode 100644 index 3b340cc8f..000000000 --- a/modules/libcom/src/libComVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef LIBCOMVERSION_H -# error include libComVersion.h, not this header -#endif -#define EPICS_LIBCOM_MAJOR_VERSION @EPICS_LIBCOM_MAJOR_VERSION@ -#define EPICS_LIBCOM_MINOR_VERSION @EPICS_LIBCOM_MINOR_VERSION@ -#define EPICS_LIBCOM_MAINTENANCE_VERSION @EPICS_LIBCOM_MAINTENANCE_VERSION@ -#define EPICS_LIBCOM_DEVELOPMENT_FLAG @EPICS_LIBCOM_DEVELOPMENT_FLAG@