# $Id: common_objy.gmk,v 1.3 2001/06/22 15:09:25 gunter Exp $ # ---------------------------------------------------------------- # Common part of GNUmakefile for libraries. John Allison, 5/7/95. # ---------------------------------------------------------------- # Splitted from common.gmk for persistency part of G4. Y.Morita, 15/3/01. PWD := $(shell (dirname `pwd`/dummy | sed -e 's/ //g')) ifdef G4ODBMS_INSTALLATION G4_SCHEMA_NAME := -schema Geant4 else G4_SCHEMA_NAME := endif G4SCHEMA_HEADER_DIR := $(G4TMPDIR) G4DDLX := ooddlx -notitle $(G4_SCHEMA_NAME) G4DDLX_FLAGS += -header_suffix .hh -ref_suffix _ref.hh -c++_suffix _ddl.cc schema_ddl := $(wildcard include/*.ddl) schema_hh := $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%.hh,$(schema_ddl)) schema_ref_hh := $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%_ref.hh,$(schema_ddl)) schema_cc := $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%_ddl.cc,$(schema_ddl)) schema_o := $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%_ddl.o ,$(schema_ddl)) # output of ooddlx in G4TMPDIR (.hh, _ref.hh, _ddl.cc) # temporaries := $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%.hh,$(schema_ddl)) # output of ooddlx in the current directory (if the process does not finish) # temporaries2 := $(patsubst include/%.ddl,%.hh,$(schema_ddl)) temporaries += $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%_ddl.cc,$(schema_ddl)) \ $(patsubst include/%.ddl,$(G4SCHEMA_HEADER_DIR)/%_ref.hh,$(schema_ddl)) temporaries2 += $(patsubst include/%.ddl,%_ddl.cc,$(schema_ddl)) \ $(patsubst include/%.ddl,%_ref.hh,$(schema_ddl)) objects += $(patsubst include/%.ddl,$(G4TMPDIR)/%_ddl.o,$(schema_ddl)) ############################################################################### # # Actual target. # # Make the .o files. $(G4TMPDIR)/%.o: src/%.cc $(G4TMPDIR)/%.d $(G4OODDLX_BOOT) ifdef CPPVERBOSE $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ) $@ $< else @echo Compiling $*.cc ... @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ) $@ $< endif $(G4TMPDIR)/%_ddl.o: $(G4SCHEMA_HEADER_DIR)/%_ddl.cc \ $(G4SCHEMA_HEADER_DIR)/%.hh \ $(G4SCHEMA_HEADER_DIR)/%_ref.hh \ $(G4TMPDIR)/%.d $(G4OODDLX_BOOT) ifdef CPPVERBOSE $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ) $@ $< else @echo Compiling $*.cc ... @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUT_OBJ) $@ $< endif # Make the temporary files. .PRECIOUS: $(G4SCHEMA_HEADER_DIR)/%_ddl.cc $(G4SCHEMA_HEADER_DIR)/%.hh \ $(G4SCHEMA_HEADER_DIR)/%_ref.hh $(G4SCHEMA_HEADER_DIR)/%_ddl.cc \ $(G4SCHEMA_HEADER_DIR)/%.hh \ $(G4SCHEMA_HEADER_DIR)/%_ref.hh: include/%.ddl $(G4OODDLX_BOOT) ifndef G4OODDLX_BOOT @echo G4OODDLX_BOOT is not defined. Stop. exit 1 endif @if [ ! -d $(G4TMPDIR) ] ; then mkdir -p $(G4TMPDIR) ;fi @if [ ! -d $(G4SCHEMA_HEADER_DIR) ] ; then mkdir -p $(G4SCHEMA_HEADER_DIR) ;fi ifdef CPPVERBOSE (cd $(G4SCHEMA_HEADER_DIR) ; \ $(G4DDLX) $(G4DDLX_FLAGS) $(CPPFLAGS) $(PWD)/$< $(G4OODDLX_BOOT) ) else @echo Preprocessing $< ... @(cd $(G4SCHEMA_HEADER_DIR) ; \ $(G4DDLX) $(G4DDLX_FLAGS) $(CPPFLAGS) $(PWD)/$< $(G4OODDLX_BOOT) ) endif # .PHONY targets are executed regardless of time-stamp of any file of # same name. .PHONY: all obj lib clean clean_libs includes obj: $(G4TMPDIR)/obj.last $(schema_hh): $(schema_ddl) install_schema: @echo installing schema header files ... -@(cp -f $(G4TMPDIR)/*.hh $(G4SCHEMA_INCLUDE)/ || \ echo " schema header file does not exist, so ignore the error message...") $(G4SCHEMA_BOOT): @rm -f $(G4SCHEMA_DIR)/G4SCHEMA @rm -f $(G4SCHEMA_DIR)/G4SCHEMA.FDDB @echo Copying schema file to $(G4SCHEMA_DIR) for FDID $(G4SCHEMA_FDID) @$(HEP_ODBMS_DIR)/etc/getdb $(HEP_ODBMS_DIR)/schema/HEP_BASE \ $(G4SCHEMA_BOOT) $(G4SCHEMA_FDID)