# $Id$ # # Rules for making things specified in Makefile.Host # # Some rules for filename-massage are system specific # and have "ifdefs" here instead of using definitions # from CONFIG.Host.$(ARCH_CLASS) - sorry about this, # but so far the rules are quite similar on all systems # except WIN32 has some specials. # # Maybe there is a way to use indentation to make it # easier to read this file? # # Most things may also work if you say e.g. # VAR+=ADD # even if ADD is not there, but this way "VAR" would # be defined in any case, that's why I try to use # ifdef ADD # VAR+=ADD # endif # # -kuk- # we are in O.$(OS_CLASS), but most sources are one dir above: # # The use of VPATH (no suffix specification) caused everything # to break several times. # vpath, of course, has the disadvantage that we need explicit rules # for scripts or similar os-specific filed which have _no_ suffix... ifdef T_A vpath %.c $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.cc $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.cpp $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.C $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.rc $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.h $(USER_VPATH) $(ALL_SRC_DIRS) vpath %.skel.static $(USER_VPATH) $(GENERIC_SRC_DIRS) #--------------------------------------------------------------- include $(CONFIG)/CONFIG_ADDONS #--------------------------------------------------------------- # Set opt and warn ifeq ($(HOST_ARCH),$(T_A)) OPT=$(HOST_OPT) WARN=$(HOST_WARN) else OPT=$(CROSS_OPT) WARN=$(CROSS_WARN) endif #--------------------------------------------------------------- # Set PROD, OBJS, LIBRARY_HOST, and LIBRARY_IOC ifeq ($(findstring Host,$(VALID_BUILDS)),Host) PROD += $(PROD_HOST) LIBRARY_HOST += $(LIBRARY) OBJS += $(OBJS_HOST) else # PROD and TESTPROD not built for ioc only builds PROD = TESTPROD = LIBRARY_HOST = LIBRARY_IOC += $(LIBRARY) endif ifeq ($(findstring Ioc,$(VALID_BUILDS)),Ioc) OBJS += $(OBJS_IOC) else LIBRARY_IOC = endif #--------------------------------------------------------------- ifdef TEMPLATES_DIR INSTALL_TEMPLATES_SUBDIR = $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR) else INSTALL_TEMPLATES_SUBDIR = $(INSTALL_TEMPLATES) endif #--------------------------------------------------------------- # must use c++ linker if linking to shared libs with c++ code LINK.c = $(LINK.cpp) #--------------------------------------------------------------- # First target all: install #--------------------------------------------------------------- # Create included Makefile for prod,testprod, and library targets ifneq (,$(strip $(PROD) $(TESTPROD) $(LIBRARY_IOC) $(LIBRARY_HOST))) MakefileInclude: ../Makefile @$(RM) $@ @$(PERL) $(TOOLS)/makeMakefileInclude.pl $(PROD) $(TESTPROD) $(LIBRARY_IOC) $(LIBRARY_HOST) $@ -include MakefileInclude endif # PROD, TESTPROD, LIBRARY_IOC or LIBRARY_HOST defined #--------------------------------------------------------------- # Libraries # LIBTARGETS += $(LIBNAME) ifneq (,$(strip $(LIBTARGETS))) LIBTARGETS += $(INSTALL_LIBS) ifeq ($(strip $(SHARED_LIBRARIES)),YES) CFLAGS += $($(ANSI)_SHRLIB_CFLAGS_YES) CXXFLAGS += $($(ANSI)_SHRLIB_CFLAGS_YES) PROD_VERSION =$(SHRLIB_VERSION) SHRLIB_LINKER = $(CXX) LIBTARGETS += $(SHRLIBNAME) $(INSTALL_SHRLIBS) $(INSTALL_DLL_LINK_LIBS) endif # SHARED_LIBRARIES=YES endif # LIBTARGETS #--------------------------------------------------------------- # Main targets install: buildInstall buildInstall : build build : inc rebuild: clean install inc: $(INSTALL_INC) $(INSTALL_OSINC) $(INSTALL_INCREC) build: $(MENUS) $(RECTYPES) $(BPTS) $(OBJSNAME) \ $(LIBTARGETS) $(PRODNAME) $(TESTPRODNAME) $(TARGETS) ifdef DBDEXPAND build: $(DBDNAME) endif buildInstall : \ $(INSTALL_SCRIPTS) $(INSTALL_PROD) \ $(INSTALL_TCLLIBS) $(INSTALL_TCLINDEX) \ $(INSTALL_OBJS) \ $(INSTALL_DOCS) \ $(INSTALL_HTMLS) \ $(INSTALL_TEMPLATE) \ $(INSTALL_CONFIGS) \ $(INSTALL_DBS) $(INSTALL_BPTS) \ $(INSTALL_DBDNAME) ifdef BIN_INSTALLS buildInstall : binInstalls endif clean:: @echo "Cleaning" @$(RM) *.i *$(OBJ) *.a $(PRODNAME) $(TESTPRODNAME) $(LIBNAME) $(SHRLIBNAME)\ $(INC) *$(RES) $(TARGETS) $(DBDINSTALL) $(MENUS) $(RECTYPES) $(BPTS) \ $(DBDNAME) *.out MakefileInclude ifdef BAF @$(RM) $(PROD_BAF) $(LIB_BAF_IOC) $(LIB_BAF_HOST) *$(BOF) endif ifdef DBDEXPAND @$(RM) $(DBDNAME) endif # WIN95/NT source browser #ifdef BAF browse: $(LIB_BAF_IOC) $(LIB_BAF_HOST) $(PROD_BAF) #endif $(DIRECTORY_TARGETS) : $(MKDIR) -p $@ #--------------------------------------------------------------- #--------------------------------------------------------------- # Generic Rules for 'simple' targets that # can be generated from a single source with same basename. # # The usual two rules .c* -> $(OBJ) and then $(OBJ) -> $(EXE) # do not work because the $(OBJ)->$(EXE) rule wouldn't # know if the original source was C or C++. # # Hint: The $(subst...) construct removes the .c or .cpp # as well as the '../' from the filename and adds $(OBJ): # e.g. $< = '../abc.c' -> 'abc.o' # # The order of the following rules is # VERY IMPORTANT !!!! depends: $(LIBSRCS_IOC) $(LIBSRCS_HOST) $(SRCS) $(COND_PROD_SRCS) @$(RM) DEPENDS touch DEPENDS $(DEPENDS_RULE) # C++ munching for VxWorks %.out : %.o @ $(RM) ctct.o ctdt.c $(NM) $< | $(MUNCH) > ctdt.c $(COMPILE.c) -traditional ctdt.c $(LINK.) $@ $< ctdt.o @ $(RM) ctdt.c ctdt.o $(PRODNAME):%$(EXE): $(PROD_OBJS) $(PROD_RESS) $(PROD_DEPLIBS) @$(RM) $@ $(LINK.cpp) $(LD_OBJS) $(LD_RESS) $(LDLIBS) %$(OBJ): %.c @$(RM) $@ $(COMPILE.c) $< %$(OBJ): %.cc @$(RM) $@ $(COMPILE.cpp) $< %$(OBJ): %.cpp @$(RM) $@ $(COMPILE.cpp) $< %$(OBJ): %.C @$(RM) $@ $(COMPILE.cpp) $< # WIN95/NT resource compiler %$(RES): %.rc @$(RM) $@ $(RCCMD) # WIN95/NT source browser %.bsc: %.sbr @echo "building source browser archive $@" @$(RM) $@ $(BAFCMD) $< # # rename the y.tab.h file only if we # are creating it # %.h %.c: ../%.y $(RM) $*.c y.tab.c ifeq ($(findstring -d, $(YACCOPT)),-d) $(RM) $*.h y.tab.h endif $(YACC) $(YACCOPT) $< $(MV) y.tab.c $*.c ifeq ($(findstring -d, $(YACCOPT)),-d) $(MV) y.tab.h $*.h endif %.c: ../%.l @$(RM) lex.yy.c $(LEX) $(LEXOPT) $< @$(RM) $@ $(MV) lex.yy.c $@ #state notation language rule %.c: ../%.st @echo "preprocessing $*.st" @$(RM) $*.i $(CPP) $(CPPFLAGS) $(CPPSNCFLAGS) $< > $*.i @echo "converting $*.i" @$(RM) $@ $(SNC) $(TARGET_SNCFLAGS) $(SNCFLAGS) $*.i %.c: %.stt @echo "converting $< ln -s $< $*.st $(SNC) $(TARGET_SNCFLAGS) $(SNCFLAGS) $*.st @$(RM) $*.st # Capfast Rules: %.db: %.edf $(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) $< %.db: ../%.edf $(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) $< %.edf: ../%.sch @if [ ! -f cad.rc -a -r ../cad.rc ] ; then ln -s ../cad.rc ; fi $(SCH2EDIF) $(SCH2EDIF_SYSFLAGS) $(SCH2EDIF_FLAGS) $< # Adl2dl rule %.dl : ../%.adl -$(ADL2DL) $< $@ # Mangen Rule: %.1:% $(MANGEN) -s $< $(MV) $( $@ endif # WIN95/NT source browser ifdef BAF $(LIB_BAF_HOST): $(addsuffix $(BOF),$(basename $(LIBSRCS_HOST))) @echo "Building source browser archive $@" @$(RM) $@ $(BAFCMD) $^ $(LIB_BAF_IOC): $(addsuffix $(BOF),$(basename $(LIBSRCS_IOC))) @echo "Building source browser archive $@" @$(RM) $@ $(BAFCMD) $^ endif ifneq (,$(wildcard ../baseLIBOBJS)) $(LIBNAME): ../baseLIBOBJS endif # rule for lib (archive of object files) creation $(LIBNAME): $(LIB_PREFIX)%$(LIB_SUFFIX): $(LIBRARY_OBJS) @$(RM) $@ $(ARCMD) $(LIBRARY_LD_OBJS) ifneq ($(strip $(RANLIB)),) $(RANLIB) $@; endif # RANLIB $(DLL_LINK_LIBNAME):$(LIB_PREFIX)%.lib: $(LIBRARY_OBJS) $(LINK.shrlib) $(LIBRARY_LD_OBJS) $(SHRLIB_LDLIBS) $(SHRLIBNAME):$(LIB_PREFIX)%$(SHRLIB_SUFFIX): $(LIBRARY_OBJS) $(LINK.shrlib) $(LIBRARY_LD_OBJS) $(SHRLIB_LDLIBS) binInstalls: $(BIN_INSTALLS) @echo "Installing $(^F)" @$(INSTALL) -d -m 555 $^ $(INSTALL_BIN) $(INSTALL_BIN)/%: ../os/$(OS_CLASS)/% @echo "Installing os-specific script $@" @$(INSTALL_PRODUCT) -d -m 555 $< $(INSTALL_BIN) $(INSTALL_BIN)/%: % @echo "Installing binary $@" @$(INSTALL_PRODUCT) -d -m 555 $< $(INSTALL_BIN) $(INSTALL_BIN)/%: ../% @echo "Installing script $@" @$(INSTALL_PRODUCT) -d -m 555 $< $(INSTALL_BIN) $(INSTALL_LIB)/%.a: %.a @echo "Installing library $@" @$(INSTALL_LIBRARY) -d -m 644 $< $(INSTALL_LIB) ifneq ($(strip $(RANLIB)),) $(RANLIB) $@ endif # RANLIB $(INSTALL_LIB)/%.lib: %.lib @echo "Installing library $@" @$(INSTALL_LIBRARY) -d -m 644 $< $(INSTALL_LIB) $(INSTALL_SHRLIB)/lib%: lib% @echo "Installing library $@" @$(INSTALL) -d -m 555 $< $(INSTALL_SHRLIB) ifdef SHRLIB_VERSION @$(RM) $(@:%.$(SHRLIB_VERSION)=%) ln -s $< $(@:%.$(SHRLIB_VERSION)=%) endif # SHRLIB_VERSION ifneq ($(INSTALL_TCLLIB),$(INSTALL_BIN)) $(INSTALL_TCLLIB)/%: % @echo "Installing Tcl library $@" @$(INSTALL) -d -m 555 $< $(INSTALL_TCLLIB) $(INSTALL_TCLLIB)/%: ../% @echo "Installing Tcl library $@" @$(INSTALL) -d -m 555 $< $(INSTALL_TCLLIB) endif $(INSTALL_CONFIG)/%: % @echo "Installing config file $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_CONFIG)/%: ../% @echo "Installing config file $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_INCLUDE)/os/$(OS_CLASS)/% : % @echo "Installing os dependent include file $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_INCLUDE)/% : % @echo "Installing generic include file $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_DOC)/%: % @echo "Installing doc $@" @$(INSTALL) -d -m 644 $< $(INSTALL_DOC) $(INSTALL_DOC)/%: ../% @echo "Installing doc $@" @$(INSTALL) -d -m 644 $< $(INSTALL_DOC) $(INSTALL_HTML)/$(HTMLS_DIR)/%: % @echo "Installing html $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_HTML)/$(HTMLS_DIR)/%: ../% @echo "Installing html $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR)/%: ../% @echo "Installing $@" @$(INSTALL) -d -m 644 $< $(@D) $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR)/%: % @echo "Installing $@" @$(INSTALL) -d -m 644 $< $(@D) .PRECIOUS: %.o %.c -include DEPENDS .PHONY: all inc depends build install clean rebuild buildInstall binInstalls \ iocBinInstalls ifneq (,$(wildcard ../base.dbd)) $(DBDNAME): ../base.dbd $(RECTYPES:%.h=../%.dbd) else $(DBDNAME): $(RECTYPES:%.h=../%.dbd) endif endif # T_A defined # EOF RULES.Host