# SoftRelTools/objy_schema.mk # # Based on Scott Snyder's make files for CINT # # Include this before standard.mk to define rules to process # Objectivity ddl files through ooddlx. # # You should/could define the following variables: # # SCHEMA_DDL = List of ddl files to be processed. # SCHEMA_DDL_DIR = List of directories to search for files # in SCHEMA_DDL. If not set, this defaults # to the current directory. # # OO_FD_BOOT = Path to the federated database boot file. # Other standard Objectivity variables # (OO_LS_HOST, OO_FDID, OO_DB_JOU, OO_DB_PATH) # should probaly also be defined. # # OBJY_DIR = Path to the root directory of Objectivity (in # an UPS environment, that variables is usely set # by something like 'setup objy'). # # You can inhibit actually running ooddlx by defining the # variable DONT_RUN_OODDLX. The dependencies on the schema # files will still be properly honored. # # By default, the generated *_ddl.cc files are put in $(workdir). # To put them somewhere else, define SCHEMA_SRCS_DIR. (If you put # them somewhere other then either $(workdir) or the current # directory, you may want to do a `vpath %.cc $(SCHEMA_SRCS_DIR)' # somewhere.) # # By default, the generated *_ref.h and *.h files are also put # in $(workdir). To put them somewhere else, define # SCHEMA_HDRS_DIR. # # Bugs: Currently these files have only been tested on Solaris. # The options to redefine output directories have not been # tested through-fully (specialy SCHEMA_HDRS_DIR). # # Input files should always have the extension .ddl # Output files will always have the extension .cc, .h # ############################################################# ############################################################# # Objectivity Directories and Tools # OO_INC_DIR = ${OBJY_DIR}/include OO_LIB_DIR = ${OBJY_DIR}/lib OO_BIN_DIR = ${OBJY_DIR}/bin OODDLX = $(OO_BIN_DIR)/ooddlx OONEWFD = $(OO_BIN_DIR)/oonewfd OODELETEFD = $(OO_BIN_DIR)/oodeletefd ############################################################# # Files produced by the DDL processor for each DDL file. # SCHEMA_SRCS = $(SCHEMA_DDL:.ddl=_ddl.cc) SCHEMA_HDRS_REF = $(SCHEMA_DDL:.ddl=_ref.h) SCHEMA_HDRS_NOREF = $(SCHEMA_DDL:.ddl=.h) SCHEMA_HDRS = $(SCHEMA_HDRS_REF) $(SCHEMA_HDRS_NOREF) ############################################################# # Update compile and link flags to include Objectivity # override CPPFLAGS += -I$(OO_INC_DIR) override LDFLAGS += -L$(OO_LIB_DIR) override LOADLIBS += -loo -lsocket ############################################################# # Directory manipulations ... # # Determine the output directories. # DDL produced source and header files will default to $(workdir) ifndef SCHEMA_SRCS_DIR SCHEMA_SRCS_DIR := $(workdir) endif ifndef SCHEMA_HDRS_DIR SCHEMA_HDRS_DIR := $(workdir) endif # Determine directories to search for SCHEMA_DDL files. # Default to current dir. ifndef SCHEMA_DDL_DIR SCHEMA_DDL_DIR := . endif # Change SCHEMA_SRCS_DIR into a relative path. # This will be needed because SRT explicitly adds the current # directory in front of the file name for compilation commands override SCHEMA_SRCS_DIR := $(shell relpathto $(SCHEMA_SRCS_DIR)) # Use vpath to find the output source files vpath %_ddl.cc $(SCHEMA_SRCS_DIR) # Full name of the output source files SCHEMA_SRCS_FILES := $(addprefix $(SCHEMA_SRCS_DIR)/,$(SCHEMA_SRCS)) ############################################################# # Add the DDL produced files to the end of LIBCCFILES. This # ensures that DDL produced files will get made before we # try to build dependencies. # Note: the dependency (.d) files depend on LIBCCFILES, so # missing SCHEMA_ARCS files will trigger the DDL processor. # LIBCCFILES += $(SCHEMA_SRCS) ############################################################# # Generate and include .d files for the headers in the DDL # input files (.ddl). The target for these are the corresponding # _ddl.cc files and the .d files itself. # include SoftRelTools/objy_schema_make_dfiles.mk ############################################################# # Options to the DDL processor # OODDLX_OPT = -c++_suffix _ddl.cc \ -header_suffix .h \ -ref_suffix _ref.h \ -include_header $(SCHEMA_HDRS_DIR)/$(addsuffix .h, $*) \ -include_ref $(SCHEMA_HDRS_DIR)/$(addsuffix _ref.h, $*) \ -notitle ############################################################# # Here runs the DDL processor, then moves the header and source code files # that are produced to the appropriate directory. # ifndef DONT_RUN_OODDLX $(SCHEMA_SRCS_FILES): $(SCHEMA_SRCS_DIR)/%_ddl.cc : $(SCHEMA_DDL_DIR)/%.ddl $(OO_FD_BOOT) @echo "<**ddl**> processing $<" $(OODDLX) $(OODDLX_OPT) -I$(CPPFLAGS) $< $(OO_FD_BOOT) mv $(SCHEMA_HDRS) $(SCHEMA_HDRS_DIR)/ mv $(SCHEMA_SRCS) $(SCHEMA_SRCS_DIR)/ endif ############################################################