# Example PRO-C module. May require modifications # as originally written for quite old version of makeit. # May also need to be customised for local needs. # # Makefile to exercise this. # # MODULES := c cc ose pcc # # MODULEPATH += . # LOCALMODULES += pcc # # PCC_OPTIONS += cc # # include makeit/init.mk # # include makeit/modules.mk vpath %.pc $(SRCDIR) ## Stop redundant checks on lex input file. %.pc : ## List current directory in include search path. ifeq "$(filter -I.,$(CPPFLAGS))" "" override CPPFLAGS += -I. endif #ifeq "$(filter -I./$(MK),$(CPPFLAGS))" "" #override CPPFLAGS += -I./$(MK) #endif ## Work out options. ifneq "$(filter cc,$(PCC_OPTIONS))" "" _pcc_cc := YES REQUIRE += cc else REQUIRE += c endif ifeq "$(filter exclude_from_library,$(PCC_OPTIONS))" "" _pcc_archive_in_library := YES endif ## Setup defaults for PCC, PCCINCPATH and PCCFLAGS. ifeq "$(PCC)" "" override PCC := pcc endif ifeq "$(origin PCCINCPATH)" "undefined" ifneq "$(origin ORACLE_HOME)" "undefined" override PCCINCPATH := $(ORACLE_HOME)/c/lib endif endif ifeq "$(origin PCCUSERID)" "undefined" override PCCUSERID := nobody endif ifeq "$(origin PCCFLAGS)" "undefined" override PCCFLAGS := include=$(PCCINCPATH) ireclen=132 oreclen=132 \ rebind=yes hold_cursor=yes select_error=no sqlcheck=limited \ userid=$(PCCUSERID) endif ## Calculate language src. _pcc_real_SRC := $(filter-out $(EXCLUDE),$(filter %.pc,$(SRCFILES))) _pcc_generated_SRC := \ $(filter-out $(EXCLUDE),$(addprefix $(MK)/,$(_pcc_generated_SRC))) ## Generate stems for src. _pcc_real_SRC_STEMS := $(basename $(_pcc_real_SRC)) _pcc_generated_SRC_STEMS := $(notdir $(basename $(_pcc_generated_SRC))) ## Let C/C++ module know about generated src files. ifeq "$(_pcc_cc)" "YES" _pcc_OUTPUT_SRC := \ $(addsuffix .cc,$(_pcc_real_SRC_STEMS) $(_pcc_generated_SRC_STEMS)) ifeq "$(_pcc_archive_in_library)" "YES" _cc_generated_SRC += $(_pcc_OUTPUT_SRC) else _cc_generated_NONLIB_SRC += $(_pcc_OUTPUT_SRC) endif else _pcc_OUTPUT_SRC := \ $(addsuffix .c,$(_pcc_real_SRC_STEMS) $(_pcc_generated_SRC_STEMS)) ifeq "$(_pcc_archive_in_library)" "YES" _c_generated_SRC += $(_pcc_OUTPUT_SRC) else _c_generated_NONLIB_SRC += $(_pcc_OUTPUT_SRC) endif endif ## Rules for generated files. ifeq "$(_pcc_cc)" "YES" %.cc : %.pc ifneq "$(_pcc_real_SRC_STEMS)" "" $(patsubst %,$(MK)/%.cc,$(_pcc_real_SRC_STEMS)) : $(MK)/%.cc : %.pc ifneq "$(PCCFILTER)" "" $(PCC) $(PCCFLAGS) iname=$< oname=$@~ cat $@~ | $(PCCFILTER) > $@ $(RM) $@~ else $(PCC) $(PCCFLAGS) iname=$< oname=$@ endif endif ifneq "$(_pcc_generated_SRC_STEMS)" "" $(patsubst %,$(MK)/%.cc,$(_pcc_generated_SRC_STEMS)) : $(MK)/%.cc : $(MK)/%.pc ifneq "$(PCCFILTER)" "" $(PCC) $(PCCFLAGS) iname=$< oname=$@~ cat $@~ | $(PCCFILTER) > $@ $(RM) $@~ else $(PCC) $(PCCFLAGS) iname=$< oname=$@ endif endif else %.c : %.pc ifneq "$(_pcc_real_SRC_STEMS)" "" $(patsubst %,$(MK)/%.c,$(_pcc_real_SRC_STEMS)) : $(MK)/%.c : %.pc ifneq "$(PCCFILTER)" "" $(PCC) $(PCCFLAGS) iname=$< oname=$@~ cat $@~ | $(PCCFILTER) > $@ $(RM) $@~ else $(PCC) $(PCCFLAGS) iname=$< oname=$@ endif endif ifneq "$(_pcc_generated_SRC_STEMS)" "" $(patsubst %,$(MK)/%.c,$(_pcc_generated_SRC_STEMS)) : $(MK)/%.c : $(MK)/%.pc ifneq "$(PCCFILTER)" "" $(PCC) $(PCCFLAGS) iname=$< oname=$@~ cat $@~ | $(PCCFILTER) > $@ $(RM) $@~ else $(PCC) $(PCCFLAGS) iname=$< oname=$@ endif endif endif