Changes to automatically generate header dependancy files.

This commit is contained in:
Janet B. Anderson
2001-07-25 14:40:18 +00:00
parent 973e8eb0bc
commit bee24cadd8
17 changed files with 92 additions and 54 deletions

View File

@ -42,5 +42,5 @@ STATIC_LDFLAGS_NO =
SHRLIB_LDFLAGS_YES = -shared
SHRLIB_LDFLAGS_NO =
DEPENDS_FLAG = -MM
HDEPENDS_FLAGS = -MM

View File

@ -29,7 +29,8 @@ CONFIG_INSTALLS += ../RULES_BUILD
BUILD_CLASS = HOST
#-------------------------------------------------------
# Divider and suffix
# Prefix and suffix
DEP=.depends
DIVIDER = .
OBJ = .
RES = .
@ -163,6 +164,7 @@ TARGET_LDFLAGS = $($(basename $@)_LDFLAGS_$(OS_CLASS)) $($(basename $@)_LDFLAGS)
TARGET_CPPFLAGS = $($(basename $@)_CPPFLAGS_$(OS_CLASS)) $($(basename $@)_CPPFLAGS)
# Level of ansi conformance flags
CONFORM_CPPFLAGS = $(CONFORM_CPPFLAGS_$(CMPLR))
CONFORM_CFLAGS = $(CONFORM_CFLAGS_$(CMPLR))
CONFORM_CXXFLAGS = $(CONFORM_CXXFLAGS_$(CMPLR))
@ -210,8 +212,8 @@ LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(DEPLIB_LDFLAGS)\
LDLIBS = $(DEPLIB_LDLIBS) $(STATIC_LDLIBS)\
$(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(OP_SYS_LDLIBS)
CPPFLAGS += $(CROSS_CPPFLAGS) $(POSIX_CPPFLAGS) $(EPICS_BASE_CPPFLAGS)\
$(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
CPPFLAGS += $(CONFORM_CPPFLAGS) $(CROSS_CPPFLAGS) $(POSIX_CPPFLAGS)\
$(EPICS_BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
$(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
#--------------------------------------------------
@ -232,16 +234,19 @@ COMPILE.cpp = $(CCC) -c $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(SOURCE_CXXFLAG)
#--------------------------------------------------
# Build depends command here
DEPENDS.cpp = $(CCC)
DEPENDSFLAGS += $(CPPFLAGS) $(INCLUDES) $(DEPENDS_FLAG)
DEPENDS_CMD.cpp = -$(DEPENDS.cpp) $(DEPENDSFLAGS) $(DEPENDS_SRC_FILES) > DEPENDS
HDEPENDS.c = $(CC)
HDEPENDS.cpp = $(CCC)
HDEPENDS_CMD.c = -$(HDEPENDS.c) $(HDEPENDS_CFLAGS) $(HDEPENDSFLAGS) $< > $*$(DEP)
HDEPENDS_CMD.cpp = -$(HDEPENDS.cpp) $(HDEPENDS_CXXFLAGS) $(HDEPENDSFLAGS) $< > $*$(DEP)
HDEPENDS_TARGETS_CMD = @$(PERL) $(TOOLS)/makeDependsTargets.pl $*$(DEP)
HDEPENDSFLAGS += $(CPPFLAGS) $(INCLUDES) $(HDEPENDS_FLAGS)
#--------------------------------------------------
# depends definition
TARGET_SRCS = $(foreach name, $(TESTPROD) $(PROD) $(LIBRARY), $($(name)_SRCS))
SRC_FILES = $(foreach src, $(LIB_SRCS) $(LIBSRCS) $(SRCS) $(PROD_SRCS) $(TARGET_SRCS) , \
$(firstword $(wildcard $(addsuffix /$(src),$(ALL_SRC_DIRS))) $(src)))
DEPENDS_SRC_FILES = $(SRC_FILES)
SRC_FILES = $(LIB_SRCS) $(LIBSRCS) $(SRCS) $(PROD_SRCS) $(TARGET_SRCS)
HDEPENDS_FILES = $(addsuffix $(DEP),$(notdir $(basename $(SRC_FILES))))
#---------------------------------------------------------------
# Names of installed items

View File

@ -88,6 +88,15 @@ SHARED_LIBRARIES=NO
# must be either YES or NO
STATIC_BUILD=NO
# Should header dependancy files be automatically generated
# for each C/C++ source code file?
# must be either YES or NO
#
# Note: On solaris and WIN32 hosts, the gnu compilers gcc and g++ are
# used to generate the dependancy files, and they must be in
# your path.
HDEPENDS=YES
# Host build optimization
# must be either YES or NO
HOST_OPT=YES

View File

@ -61,7 +61,7 @@ install: buildInstall
rebuild: clean install
.PHONY: all inc depends build install clean rebuild buildInstall
.PHONY: all inc build install clean rebuild buildInstall
endif # T_A defined
@ -146,6 +146,14 @@ $(COMMON_DIR)/menu%.h: ../menu%.dbd
@$(RM) $@
$(DBTOMENUH) $< $@
$(COMMON_DIR)/%Record.h: %Record.dbd
@$(RM) $@
$(DBTORECORDTYPEH) $(DBDFLAGS) $< $@
$(COMMON_DIR)/menu%.h: menu%.dbd
@$(RM) $@
$(DBTOMENUH) $< $@
##################################################### DBD files
$(COMMON_DIR)/bpt%.dbd: ../bpt%.data

View File

@ -10,7 +10,6 @@ ACTIONS = inc
ACTIONS += build
ACTIONS += install
ACTIONS += buildInstall
ACTIONS += depends
ACTIONS += browse
actionPart = $(word 1, $(subst $(DIVIDER), ,$@))

View File

@ -72,6 +72,14 @@ endif
all: install
-include $(CONFIG)/RULES.Db
ifeq ($(HDEPENDS),YES)
ifneq (,$(strip $(HDEPENDS_FILES)))
-include $(HDEPENDS_FILES)
endif
endif
#---------------------------------------------------------------
# Create included Makefile for prod,testprod, and library targets
@ -142,7 +150,7 @@ clean::
@$(RM) *.i *$(OBJ) *.a $(PRODNAME) $(TESTPRODNAME) $(LIBNAME) $(SHRLIBNAME)\
$(INC) *$(RES) $(TARGETS) \
*.out MakefileInclude \
$(COMMON_INC)
$(COMMON_INC) $(HDEPENDS_FILES)
ifdef MUNCHNAME
@$(RM) $(MUNCHNAME) $(CTDT_SRCS) $(CTDT_OBJS) $(NMS)
endif
@ -174,13 +182,6 @@ $(DIRECTORY_TARGETS) :
# The order of the following rules is
# VERY IMPORTANT !!!!
depends: inc $(DEPENDS_SRC_FILES)
@$(RM) DEPENDS
@touch DEPENDS
ifneq (,$(strip $(DEPENDS_SRC_FILES)))
$(DEPENDS_CMD.cpp)
endif
$(TESTPRODNAME) $(PRODNAME):%$(EXE): $(PRODUCT_OBJS) $(PROD_RESS) $(PROD_DEPLIBS)
@$(RM) $@
$(LINK.cpp)
@ -195,18 +196,38 @@ $(OBJLIBNAME):%$(OBJ): $(OBJLIB_LD_OBJS)
$(COMPILE.c) -traditional $<
%$(OBJ): %.c
ifeq ($(HDEPENDS),YES)
@$(RM) $*$(DEP)
@$(HDEPENDS_CMD.c)
@$(HDEPENDS_TARGETS_CMD) $*$(DEP)
endif
@$(RM) $@
$(COMPILE.c) $<
%$(OBJ): %.cc
ifeq ($(HDEPENDS),YES)
@$(RM) $*$(DEP)
@$(HDEPENDS_CMD.cpp)
@$(HDEPENDS_TARGETS_CMD) $*$(DEP)
endif
@$(RM) $@
$(COMPILE.cpp) $<
%$(OBJ): %.cpp
ifeq ($(HDEPENDS),YES)
@$(RM) $*$(DEP)
@$(HDEPENDS_CMD.cpp)
@$(HDEPENDS_TARGETS_CMD) $*$(DEP)
endif
@$(RM) $@
$(COMPILE.cpp) $<
%$(OBJ): %.C
ifeq ($(HDEPENDS),YES)
@$(RM) $*$(DEP)
@$(HDEPENDS_CMD.cpp)
@$(HDEPENDS_TARGETS_CMD) $*$(DEP)
endif
@$(RM) $@
$(COMPILE.cpp) $<
@ -407,14 +428,10 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: %
@echo "Installing $@"
@$(INSTALL) -d -m 644 $< $(@D)
.PRECIOUS: %.i %.o %.c %.nm %.cpp
.PRECIOUS: %.i %.o %.c %.nm %.cpp %.cc
.PRECIOUS: $(COMMON_INC)
-include $(CONFIG)/RULES.Db
-include DEPENDS
.PHONY: all inc depends build install clean rebuild buildInstall binInstalls
.PHONY: all inc build install clean rebuild buildInstall binInstalls
# EOF RULES_BUILD

View File

@ -4,7 +4,7 @@
ARCHS += $(BUILD_ARCHS)
ACTIONS += inc build install buildInstall depends clean
ACTIONS += inc build install buildInstall clean
dirPart = $(word 1, $(subst $(DIVIDER), ,$@))
actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$@)), \

View File

@ -68,14 +68,12 @@ help:
@echo " in all except the O.<arch> level Makefile"
@echo " rebuild - Same as clean install"
@echo " inc - Installs header files"
@echo " depends - Generates include header file dependencies"
@echo " build - Builds all targets"
@echo "\"Partial\" build targets supported by Makefiles:"
@echo " inc.<arch> - Installs <arch> only header files."
@echo " install.<arch> - Builds and installs <arch> only."
@echo " clean.<arch> - Cleans <arch> binaries in O.<arch> dirs only."
@echo " build.<arch> - Builds <arch> only."
@echo " depends.<arch> - Generates <arch> dependencies only."
@echo "Targets supported by top level Makefile:"
@echo " uninstall - Cleans directories created by the install."
@echo " distclean - Same as clean uninstall."

View File

@ -8,33 +8,35 @@
TOP = ../../..
include $(TOP)/configure/CONFIG
# Add-on CFLAGS that are needed by this Makefile.
# Add-on CPPFLAGS that are needed by this Makefile.
# (If possible, all system specific flags should be
# defined in configure/os/CONFIG.<host>.<target>
#
# These CFLAGS rules also apply to these Makefile-variables:
# These CPPFLAGS rules also apply to these Makefile-variables:
# CPPFLAGS C preprocessor flags
# CFLAGS C flags
# CXXFLAGS C++ flags
# LDFLAGS link flags
#
# This is used on all systems:
USR_CFLAGS = -DVAR=value -Ddefine_for_all_systems
USR_CPPFLAGS = -DVAR=value -Ddefine_for_all_systems
# ..only for WIN32:
USR_CFLAGS_WIN32 = -DVERSION='WIN32 port'
USR_CPPFLAGS_WIN32 = -DVERSION='WIN32 port'
#
# -nil- is special:
# if USR_CFLAGS_WIN32 was undefined or empty, .._DEFAULT would have
# if USR_CPPFLAGS_WIN32 was undefined or empty, .._DEFAULT would have
# been used.
# To indicate
# "yes, there is a special USR_CFLAGS for WIN32, but it's empty"
# "yes, there is a special USR_CPPFLAGS for WIN32, but it's empty"
# you have to set it to -nil-:
USR_CFLAGS_WIN32 = -nil-
USR_CPPFLAGS_WIN32 = -nil-
# .. for all other arch classes:
USR_CFLAGS_DEFAULT = -DVERSION='generic Unix'
USR_CPPFLAGS_DEFAULT = -DVERSION='generic Unix'
# CFLAGS that are only used to compile a_file.c or a_file.cpp:
# CPPFLAGS that are only used to compile a_file.c or a_file.cpp:
#
a_file_CFLAGS = -DIN_A_FILE
a_file_CFLAGS_WIN32 = -DVERSION='WIN32 port'
a_file_CPPFLAGS = -DIN_A_FILE
a_file_CPPFLAGS_WIN32 = -DVERSION='WIN32 port'
# ---------------------------------------------------------
# general rule for all .c .cpp .h .hh files and scripts:

View File

@ -62,7 +62,8 @@ CTDT_SRCS += $(OBJLIBNAME:%$(OBJ)=%_ctdt.c)
CTDT_OBJS += $(OBJLIBNAME:%$(OBJ)=%_ctdt$(OBJ))
NMS += $(OBJLIBNAME:%$(OBJ)=%.nm)
OBJLIB_LINK.cpp = $(LD) -o $@ $(OBJLIB_LD_OBJS)
TARGET_SRCS += $(foreach name, $(OBJLIB), $($(name)_SRCS))
SRC_FILES += $(OBJLIB_SRCS)
#--------------------------------------------------
# vxWorks directory definitions

View File

@ -53,5 +53,5 @@ STATIC_LDLIBS_NO=
SHRLIB_LDFLAGS_YES = -G -h $@
DEPENDS_FLAG = +m
HDEPENDS_FLAGS = +m

View File

@ -43,7 +43,7 @@ STATIC_LDLIBS_NO=
SHRLIB_LDFLAGS_YES = -shared
DEPENDS_FLAG =
HDEPENDS_FLAGS =
############# ???????????
#####ACC_SFLAGS_YES= -non_shared

View File

@ -57,6 +57,7 @@ SHRLIB_LDFLAGS_YES = -G -h $@
# gnu compiler used because Sun compiler output
# includes headers from /opt/SUNWspro and does
# not work for c++ headers without .h suffix.
DEPENDS_FLAG = -MM
DEPENDS.cpp = g++
HDEPENDS_FLAGS = -MM
HDEPENDS.c = gcc
HDEPENDS.cpp = g++

View File

@ -57,6 +57,6 @@ SHRLIB_LDFLAGS_YES = -G -h $@
# gnu compiler used because Sun compiler output
# includes headers from /opt/SUNWspro and does
# not work for c++ headers without .h suffix.
DEPENDS_FLAG = -MM
DEPENDS.cpp = g++
HDEPENDS_FLAGS = -MM
HDEPENDS.cpp = g++

View File

@ -46,5 +46,5 @@ STATIC_LDLIBS_NO=
SHRLIB_LDFLAGS_YES = -assert pure-text -h $@
DEPENDS_FLAG = -xM1
HDEPENDS_FLAGS = -xM1

View File

@ -29,10 +29,10 @@ ARCMD = lib /nologo /verbose /out:$@ $(LIBRARY_LD_OBJS)
BAFCMD = bscmake /nologo /o $@
#DEPENDS_RULE = @echo depends target not supported
#GNU depends flag
DEPENDS.cpp = g++
DEPENDS_FLAG = -MM
# gnu compiler used to create depends files (not available in Visual C++)
HDEPENDS_FLAGS = -MM $(addprefix -I,$(subst ;, ,$(INCLUDE)))
HDEPENDS.c = gcc
HDEPENDS.cpp = g++
#
# Configure OS vendor C compiler

View File

@ -69,8 +69,6 @@ foreach $name ( @nameList ) {
print OUT "endif\n";
print OUT "${name}_OBJS+=\$(addsuffix \$(OBJ),\$(basename \$(${name}_SRCS)))\n";
print OUT "\n";
print OUT "depends: \$(${name}_SRCS)\n";
print OUT "\n";
print OUT "ifeq (\$(filter ${name},\$(TESTPROD)),${name})\n";
print OUT "ifeq (,\$(strip \$(${name}_OBJS) \$(PRODUCT_OBJS)))\n";
print OUT "${name}_OBJS+=${name}\$(OBJ)\n";