diff options
author | Martin Burnicki <martin.burnicki@meinberg.de> | 2022-09-07 19:21:56 +0200 |
---|---|---|
committer | Martin Burnicki <martin.burnicki@meinberg.de> | 2022-09-07 19:21:56 +0200 |
commit | f8f9f5c81a6361d126a31df5c08d21ab7895814e (patch) | |
tree | 8632b18586678f5743766f6b382936b7f0c794e2 /makefile-supp-syn1588.mk | |
parent | aec234a7975f35e6c1227a95a5c22017e94fc621 (diff) | |
download | mbgtools-lx-f8f9f5c81a6361d126a31df5c08d21ab7895814e.tar.gz mbgtools-lx-f8f9f5c81a6361d126a31df5c08d21ab7895814e.zip |
Change name of a sub-makefile to lowercase
Diffstat (limited to 'makefile-supp-syn1588.mk')
-rw-r--r-- | makefile-supp-syn1588.mk | 287 |
1 files changed, 287 insertions, 0 deletions
diff --git a/makefile-supp-syn1588.mk b/makefile-supp-syn1588.mk new file mode 100644 index 0000000..d19e257 --- /dev/null +++ b/makefile-supp-syn1588.mk @@ -0,0 +1,287 @@ + +######################################################################### +# +# $Id: makefile-supp-syn1588.mk 1.4 2022/07/06 14:39:27 martin.burnicki REL_M $ +# +# Makefile to be included in the top-level makefile +# of projects with SYN1588 support. +# +# ----------------------------------------------------------------------- +# $Log: makefile-supp-syn1588.mk $ +# Revision 1.4 2022/07/06 14:39:27 martin.burnicki +# Updated syn1588 module list. +# Revision 1.3 2022/05/30 09:23:28 martin.burnicki +# Support build option DEBUG_SYN1588_C_API. +# Revision 1.2 2022/03/10 15:43:52 martin.burnicki +# If a link has been set up that points to a specific directory with SYN1588 +# support files, assume that SYN1588 support is to be included by default. +# Revision 1.1 2022/02/18 16:41:44 martin.burnicki +# Initial revision where most SYN1588 stuff was +# moved here from the top level Makefile. +# +######################################################################### + +# If a link has been set up that points to a specific directory +# with SYN1588 support files, we assume that SYN1588 support +# is to be included by default. +ifndef SYN1588_DIR + ifneq (,$(wildcard $(MBGLIB)/syn1588-dir)) + SYN1588_DIR = syn1588-dir + endif +endif + +# If a SYN1588 subdirectory (within mbglib) has explicitly +# been defined, we enable support for SYN1588 cards by default. +ifdef SYN1588_DIR + SUPP_SYN1588 ?= 1 +endif + +# Unless support for SYN1588 cards has explicitly been enabled, +# it is disabled by default, +# The reason is that a C++ compiler is required only +# for the SYN1588 stuff, and the C++ compiler has to be +# e.g. gcc/g++ 8 or newer. +SUPP_SYN1588 ?= 0 + + +# Some secondary symbols related to SYN1588. +SUPP_SYN1588_USR_SPC ?= $(SUPP_SYN1588) +SUPP_SYN1588_USR_SPC_CPP ?= $(SUPP_SYN1588_USR_SPC) +SUPP_SYN1588_SHM ?= 0 +DEBUG_SYN1588_C_API ?= 0 + + +# The default subdirectory within the mbglib directory +# where the distributed SYN1588-specific files are located. +SYN1588_DIST_DIR = syn1588 + +# Unless a directory for the SYN1588 API has explicitly +# been specified, we use the default directory. +SYN1588_DIR ?= $(SYN1588_DIST_DIR) + + +# The basic list of SYN1588 API files required +# to build the driver package with SYN1588 support. +SYN1588_API_FILES = src/basicfunctions.h +SYN1588_API_FILES += src/basictypes.h +SYN1588_API_FILES += src/datasets.h +SYN1588_API_FILES += src/libs/clock/config_clock.h +SYN1588_API_FILES += src/libs/clock_ifc.h +SYN1588_API_FILES += src/libs/config/configdata.h +SYN1588_API_FILES += src/libs/config_ifc.h +SYN1588_API_FILES += src/libs/datatypes.h +SYN1588_API_FILES += src/libs/hwclock_ifc.h +SYN1588_API_FILES += src/libs/io_ifc.h +SYN1588_API_FILES += src/libs/log/config_log.h +SYN1588_API_FILES += src/libs/log/log.cpp +SYN1588_API_FILES += src/libs/log/log.h +SYN1588_API_FILES += src/libs/log_ifc.h +SYN1588_API_FILES += src/libs/network/config_network.h +SYN1588_API_FILES += src/libs/os.h +SYN1588_API_FILES += src/libs/os/$(TGT_SYSTEM)/os.cpp +SYN1588_API_FILES += src/libs/ptpdatatypes/basictypes.cpp +SYN1588_API_FILES += src/libs/security/config_security.h +SYN1588_API_FILES += src/libs/syn1588/$(TGT_SYSTEM)/syn1588_impl.cpp +SYN1588_API_FILES += src/libs/syn1588/syn1588.cpp +SYN1588_API_FILES += src/libs/syn1588/syn1588.h +SYN1588_API_FILES += src/libs/syn1588/syn1588_c_api.cpp +SYN1588_API_FILES += src/libs/syn1588/syn1588_check_register_access.cpp +SYN1588_API_FILES += src/libs/syn1588/syn1588_check_register_access.h +SYN1588_API_FILES += src/libs/syn1588/syn1588_ifc.cpp +SYN1588_API_FILES += src/libs/syn1588/syn1588_impl.h +SYN1588_API_FILES += src/libs/syn1588/ts_config.cpp +SYN1588_API_FILES += src/libs/syn1588/ts_config.h +SYN1588_API_FILES += src/libs/syn1588_c_api.h +SYN1588_API_FILES += src/libs/syn1588_ifc.h +SYN1588_API_FILES += src/msgx.h +SYN1588_API_FILES += src/ptptime.h + +ifneq ($(ALT_SYSTEM),) + # A list of API files for the alternate system only. + SYN1588_API_FILES_OPT_SYS += src/libs/os/$(ALT_SYSTEM)/os.cpp + SYN1588_API_FILES_OPT_SYS += src/libs/syn1588/$(ALT_SYSTEM)/syn1588_impl.cpp +endif + + +ifneq ($(SUPP_SYN1588_SHM),0) + # These files are only required if shared memory support + # is to be included. + SYN1588_API_FILES += src/libs/sharedmem/config_io.h + SYN1588_API_FILES += src/libs/sharedmem/io.cpp + SYN1588_API_FILES += src/libs/sharedmem/io.h + SYN1588_API_FILES += src/libs/sharedmem/io_reduced.cpp + SYN1588_API_FILES += src/libs/sharedmem/io_reduced.h + SYN1588_API_FILES += src/libs/sharedmem/$(TGT_SYSTEM)/semaphore_impl.cpp + SYN1588_API_FILES += src/libs/sharedmem/$(TGT_SYSTEM)/semaphore_impl.h + SYN1588_API_FILES += src/libs/sharedmem/$(TGT_SYSTEM)/sharedmem.cpp + SYN1588_API_FILES += src/libs/sharedmem/$(TGT_SYSTEM)/sharedmem.h + SYN1588_API_FILES += src/libs/sharedmem/semaphore_ifc.h + SYN1588_API_FILES += src/libs/sharedmem/sharedmem_api.cpp + SYN1588_API_FILES += src/libs/sharedmem/sharedmem_layout.h + SYN1588_API_FILES += src/libs/sharedmem/sharedmem_layout_ptpv2.h + SYN1588_API_FILES += src/libs/sharedmem_api.h + + ifneq ($(ALT_SYSTEM),) + # A list of API files for the alternate system only. + SYN1588_API_FILES_OPT_SYS += src/libs/sharedmem/$(ALT_SYSTEM)/semaphore_impl.cpp + SYN1588_API_FILES_OPT_SYS += src/libs/sharedmem/$(ALT_SYSTEM)/semaphore_impl.h + SYN1588_API_FILES_OPT_SYS += src/libs/sharedmem/$(ALT_SYSTEM)/sharedmem.cpp + SYN1588_API_FILES_OPT_SYS += src/libs/sharedmem/$(ALT_SYSTEM)/sharedmem.h + endif +endif + + +SYN1588_API_FILES_OPT_NEW += src/libs/config/simple_utils.cpp +SYN1588_API_FILES_OPT_NEW += src/libs/config/simple_utils.h +ifeq ($(TGT_SYSTEM),$(SYSTEM_WIN32)) + # The next file is yet only required for the win32 target. + SYN1588_API_FILES_OPT_NEW += src/libs/snprintf_safe.h +endif + +SYN1588_API_FILES_OPT += $(SYN1588_API_FILES_OPT_NEW) + + +ifneq ($(SUPP_SYN1588_USR_SPC_CPP),0) + + # Create lists of .cpp and .c source files that belong to the API. + SYN1588_SOURCES_CPP = $(filter %.cpp,$(SYN1588_API_FILES) $(SYN1588_API_FILES_OPT)) + SYN1588_SOURCES_C = $(filter %.c,$(SYN1588_API_FILES) $(SYN1588_API_FILES_OPT)) + SYN1588_SOURCES = $(SYN1588_SOURCES_CPP) $(SYN1588_SOURCES_C) + + # Determine the list of files that have to be added + # to the OBJS list. + SYN1588_SRC_FILES_CPP = $(notdir $(SYN1588_SOURCES_CPP)) + SYN1588_SRC_FILES_C = $(notdir $(SYN1588_SOURCES_C)) + SYN1588_OBJS = $(SYN1588_SRC_FILES_CPP:.cpp=.o) $(SYN1588_SRC_FILES_C:.c=.o) + + # Determine the list of directories that have + # to be added to VPATH. + SYN1588_SRC_DIRS = $(addprefix $(MBGLIB)/$(SYN1588_DIR)/,$(sort $(dir $(SYN1588_SOURCES)))) + + # Determine the list of directories that have + # to be added to the include search path. + SYN1588_HEADERS = $(filter %.h,$(SYN1588_API_FILES) $(SYN1588_API_FILES_OPT)) + + ifeq ($(TGT_SYSTEM),$(SYSTEM_WIN32)) + # On Windows we need a specific list of include search + # paths. Otherwise there may be name clashes of some + # header files from the SYN1588 API with standard headers, + # resulting in build errors. + SYN1588_INC_DIR_LIST = . + SYN1588_INC_DIR_LIST += src + SYN1588_INC_DIR_LIST += proj/gcc + SYN1588_INC_DIR_LIST += src/libs + SYN1588_INC_DIR_LIST += src/libs/ptpdatatypes + SYN1588_INC_DIR_LIST += src/libs/log + SYN1588_INC_DIR_LIST += src/libs/os/win32 + SYN1588_INC_DIR_LIST += src/libs/syn1588/ + SYN1588_INC_DIR_LIST += src/libs/syn1588/win32 + SYN1588_INC_DIR_LIST += src/libs/sharedmem/win32 + + SYN1588_INC_DIR_LIST += $(dir $(filter %.h,$(SYN1588_API_FILES_OPT))) + + SYN1588_INC_DIRS = $(addprefix $(MBGLIB)/$(SYN1588_DIR)/,$(SYN1588_INC_DIR_LIST)) + else + # For other targets we just add the directories that + # contain any of the header files in $(SYN1588_API_FILES). + SYN1588_INC_DIR_LIST = $(dir $(SYN1588_HEADERS)) + + SYN1588_INC_DIRS = $(addprefix $(MBGLIB)/$(SYN1588_DIR)/,$(sort $(SYN1588_INC_DIR_LIST))) + endif + + CPPFLAGS_SYN1588_INC = $(patsubst %,-I%,$(SYN1588_INC_DIRS)) +endif + +export SUPP_SYN1588_USR_SPC +export SUPP_SYN1588_USR_SPC_CPP +export DEBUG_SYN1588_C_API +export SYN1588_OBJS + + +ifdef DEBUG + ifneq ($(SUPP_SYN1588_USR_SPC),0) + SUPP_SYN1588_USR_SPC_DEBUG ?= $(DEBUG) + endif +endif + +SUPP_SYN1588_USR_SPC_DEBUG ?= 0 + +$(call debug_msg,$(INFO) SYN1588_DIR: $(SYN1588_DIR)) +$(call debug_msg,$(INFO) SYN1588_DIR_FOUND: $(SYN1588_DIR_FOUND)) +$(call debug_msg,$(INFO) SUPP_SYN1588: $(SUPP_SYN1588)) +$(call debug_msg,$(INFO) SUPP_SYN1588_USR_SPC: $(SUPP_SYN1588_USR_SPC)) +$(call debug_msg,$(INFO) SUPP_SYN1588_USR_SPC_CPP: $(SUPP_SYN1588_USR_SPC_CPP)) +$(call debug_msg,$(INFO) SUPP_SYN1588_USR_SPC_DEBUG: $(SUPP_SYN1588_USR_SPC_DEBUG)) +$(call debug_msg,$(INFO) DEBUG_SYN1588_C_API: $(DEBUG_SYN1588_C_API)) + + +CPPFLAGS_SYN1588 += -DSUPP_SYN1588=$(SUPP_SYN1588) +CPPFLAGS_SYN1588 += -DSUPP_SYN1588_USR_SPC=$(SUPP_SYN1588_USR_SPC) +CPPFLAGS_SYN1588 += -DSUPP_SYN1588_USR_SPC_CPP=$(SUPP_SYN1588_USR_SPC_CPP) +CPPFLAGS_SYN1588 += -DSUPP_SYN1588_SHM=$(SUPP_SYN1588_SHM) +CPPFLAGS_SYN1588 += -DSUPP_SYN1588_USR_SPC_DEBUG=$(SUPP_SYN1588_USR_SPC_DEBUG) +CPPFLAGS_SYN1588 += -DDEBUG_SYN1588_C_API=$(DEBUG_SYN1588_C_API) +CPPFLAGS_SYN1588 += -DNO_LOGGING=1 +CPPFLAGS_SYN1588 += -DLOG_LEVEL=-1 + + +ifneq ($(SUPP_SYN1588_USR_SPC_CPP),0) + ifneq ($(SUPP_SYN1588_SHM),0) + # If we want to support the SYN1588 SHM with + # newer versions of the SYN1588 source code, + # we have to define _SHARED_MEM_. + CPPFLAGS_SYN1588 += -D_SHARED_MEM_=1 + endif + + ifeq ($(TGT_SYSTEM),$(SYSTEM_WIN32)) + CPPFLAGS_SYN1588 += -include winsock2.h + endif + + # If we use some C++ files, we probably also need + # to link against the standard C++ run time library. + LDLIBS_SYN1588 += -lstdc++ +endif + +#================================================================================== + +# The section below is only useful for a maintainer of the driver package. +# The target syn1588_dist can be used to update the SYN1588 distribution files +# from a full PTPv2 repo. + +# Check if the src repo directory exists. +SYN1588_REPO_DIR = $(MBGLIB)/PTPv2 +SYN1588_REPO_DIR_FOUND = $(call chk_exist_dir, $(SYN1588_REPO_DIR)) + +ifneq ($(SYN1588_REPO_DIR_FOUND),) + # The src repo directory exists, so we can copy + # the API files. + + SYN1588_DST_DIR = $(MBGLIB)/$(SYN1588_DIST_DIR) + + SYN1588_DIST_DST_FILES := $(addprefix $(SYN1588_DST_DIR)/,$(SYN1588_API_FILES) $(SYN1588_API_FILES_OPT_NEW)) + +.PHONY: syn1588_dist +syn1588_dist: syn1588_dist_clean $(SYN1588_DIST_DST_FILES) + + +$(SYN1588_DIST_DST_FILES) : $(addprefix $(SYN1588_DST_DIR), %) : $(addprefix $(SYN1588_REPO_DIR), %) + @mkdir -p $(dir $@) + @cp -pv $< $@ + @chmod 644 $@ + +else + + # The src repo directory exists, so we + # just print an error message. + +.PHONY: syn1588_dist +syn1588_dist: + @echo "Repo dir $(SYN1588_REPO_DIR) not found." + +endif + + +.PHONY: syn1588_dist_clean +syn1588_dist_clean: + rm -rf $(SYN1588_DST_DIR) + |