Flattened Makefile 1

From HELIOS Digital DAQ
Jump to navigation Jump to search

Flattened Makefile 1

Using a pile of copy/paste, let's try to build a flat makefile from the many levels of other files including other files. This isn't just a simple copy/paste operation, because we also have to expand all the variable references for paths, but some variables are re-used. In doing this we have to realize that Make acts like a two-pass assembler, first building the symbol table (so forward reference is technically legal), then doing all the expansion of the symbols and handling the rules that have been invoked by the user. When invoking make you can supply a list of rules (actions) at the command line and make will dig through the makefiles to find the matching segments of actions corresponding to each rule. Nice idea but hard to work with if that means significant amounts of the code are never used because all the user ever does is say 'make' with no arguments.

1 Begin copying code from /global/devel/gretTop/9-22/dgsDrivers/Makefile.


#Makefile at top of application tree
TOP = .
include $(TOP)/configure/CONFIG
 

1.1 Manual expansion of line include /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG is below.


#CONFIG
include $(TOP)/configure/CONFIG_APP
 

1.1.1 Manual expansion of line include /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG_APP is below.


# CONFIG_APP
include $(TOP)/configure/RELEASE
 
1.1.1.1 Manual expansion of line include /global/devel/gretTop/9-22/dgsDrivers/configure/RELEASE is below.

#RELEASE Location of external products
# Run "gnumake clean uninstall install" in the application
# top directory each time this file is changed.
#
# NOTE: The build does not check dependancies on files
# external to this application. Thus you should run
# "gnumake clean uninstall install" in the top directory
# each time EPICS_BASE, SNCSEQ, or any other external
# module defined in the RELEASE file is rebuilt.

TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top

GRETVME=./../gretVME
DATASERVER=./../gretClust

#If using the sequencer, point SNCSEQ at its top directory:
SNCSEQ=/global/develbuild/supTop/31410/sncseq-2.0.12

ASYN=/global/develbuild/synApps/asyn/asyn4-17

# EPICS_BASE usually appears last so other apps can override stuff:
#EPICS_BASE=/global/develbuild/base/R3.14.10
EPICS_BASE=/global/develbuild/base/base-3.14.12.1

#Capfast users may need the following definitions
#CAPFAST_TEMPLATES=
#SCH2EDIF_PATH=
 
END 1.1.1.1 Manual expansion of included file. Back to level 1.1.1

 
-include ./configure/RELEASE.$(EPICS_HOST_ARCH)                          ##jta: forward definition
-include ./configure/RELEASE.Common.$(T_A)                               ##jta: forward definition
-include ./configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)                   ##jta: forward definition

CONFIG=/global/develbuild/base/base-3.14.12.1/configure
include $(CONFIG)/CONFIG

 
1.1.1.2 Expansion of line include /global/develbuild/base/base-3.14.12.1/configure/CONFIG is below.
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution. 
#*************************************************************************
#
#  Revision-Id: [email protected]
#
#  The developer may edit this file.
# assume T_A is the host arch if not specified

#
#  Common build definitions
#

ifneq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),)
EPICS_BASE = $(INSTALL_LOCATION)
CONFIG = $(TOP)/configure
BASE_TOP=YES
else
CONFIG ?= $(EPICS_BASE)/configure
endif

# Provide a default if the user hasn't set EPICS_HOST_ARCH
ifeq ($(origin EPICS_HOST_ARCH), undefined)
# NB: Must use a simply expanded variable here for performance:
EPICS_HOST_ARCH := $(shell $(CONFIG)/../startup/EpicsHostArch.pl)
endif
#

-include $(CONFIG)/os/CONFIG_COMPAT

-include $(CONFIG)/RELEASE
-include $(CONFIG)/RELEASE.$(EPICS_HOST_ARCH)
-include $(CONFIG)/RELEASE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(CONFIG)/RELEASE.Common.$(T_A)
-include $(CONFIG)/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
endif

include $(CONFIG)/CONFIG_COMMON
 
1.1.1.2.1 Expansion of line include /global/develbuild/base/base-3.14.12.1/configure/CONFIG_COMMON is below.
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution. 
#*************************************************************************
#
#  Revision-Id: [email protected]
#
#  CONFIG_COMMON
#
#  This file is to be maintained by the community.
#
# Common Configuration Information

#-------------------------------------------------------
# POSIX is OS default
POSIX=YES

#-------------------------------------------------------
# Divider symbol
DIVIDER = .

#-------------------------------------------------------
# Build architectures

# CROSS1 will be defined only when CROSS_COMPILER_HOST_ARCHS is NOT defined
CROSS1 = $(CROSS_COMPILER_TARGET_ARCHS$(word 1,$(CROSS_COMPILER_HOST_ARCHS)))

# CROSS2 will be defined only when CROSS_COMPILER_HOST_ARCHS is defined
# and EPICS_HOST_ARCH is one of it's words
CROSS2 = $(CROSS_COMPILER_TARGET_ARCHS$(filter-out 1,$(words $(filter $(EPICS_HOST_ARCH),$(CROSS_COMPILER_HOST_ARCHS)))))

BUILD_ARCHS = $(EPICS_HOST_ARCH) $(CROSS1) $(CROSS2)

#-------------------------------------------------------
# Default for perl if it's on the PATH,
# otherwise override this in os/CONFIG_SITE.<host_arch>.Common
PERL=perl

#-------------------------------------------------------
# dbst based database optimization default
DB_OPT = NO

#-------------------------------------------------------
# Check configure/RELEASE file for consistency
CHECK_RELEASE_YES = checkRelease
CHECK_RELEASE_NO =
CHECK_RELEASE_WARN = warnRelease

#-------------------------------------------------------
# GNU directory
# GNU_DIR definition is here because it is used to find
# READLINE library even if GNU compiler is not used
GNU_DIR = /usr

#-------------------------------------------------------
# Directories

INSTALL_LOCATION            = $(TOP)

INSTALL_LOCATION_LIB        = $(INSTALL_LOCATION)/lib
INSTALL_LOCATION_BIN        = $(INSTALL_LOCATION)/bin

INSTALL_HOST_BIN            = $(INSTALL_LOCATION_BIN)/$(EPICS_HOST_ARCH)
INSTALL_HOST_LIB            = $(INSTALL_LOCATION_LIB)/$(EPICS_HOST_ARCH)

INSTALL_INCLUDE             = $(INSTALL_LOCATION)/include
INSTALL_DOC                 = $(INSTALL_LOCATION)/doc
INSTALL_HTML                = $(INSTALL_LOCATION)/html
INSTALL_TEMPLATES           = $(INSTALL_LOCATION)/templates
INSTALL_DBD                 = $(INSTALL_LOCATION)/dbd
INSTALL_DB                  = $(INSTALL_LOCATION)/db
INSTALL_CONFIG              = $(INSTALL_LOCATION)/configure
INSTALL_JAVA                = $(INSTALL_LOCATION)/javalib

#Directory for OS independant build created files
COMMON_DIR = ../O.Common

#-------------------------------------------------------
# Make echo output - suppress echoing if make's '-s' flag is set
ECHO := $(if $(findstring s,$(MAKEFLAGS)),\#,@echo)

#-------------------------------------------------------
ifdef T_A

INSTALL_LIB                 = $(INSTALL_LOCATION_LIB)/$(T_A)
INSTALL_SHRLIB              = $(INSTALL_LOCATION_LIB)/$(T_A)
INSTALL_TCLLIB              = $(INSTALL_LOCATION_LIB)/$(T_A)
INSTALL_BIN                 = $(INSTALL_LOCATION_BIN)/$(T_A)

#Directories for libraries
SHRLIB_SEARCH_DIRS          = $(INSTALL_LIB)

#-------------------------------------------------------
# Ext, app, and module configure dir targets
CONFIG_INSTALLS += ../RULES_BUILD ../RELEASE*

#-------------------------------------------------------
# Cross compile default, HOST or CROSS, CONFIG.crossCommon will override
BUILD_CLASS = HOST

#-------------------------------------------------------
# Build defaults, CONFIG_SITE, CONFIG, or os/CONFIG* will override
STATIC_BUILD=NO
SHARED_LIBRARIES=YES
HOST_OPT=YES
CROSS_OPT=YES
HOST_WARN=YES
CROSS_WARN=YES
GNU=NO

#-------------------------------------------------------
# Run checkRelease in $(TOP)/configure/O.*
CONFIG_TARGETS += $(CHECK_RELEASE_$(CHECK_RELEASE))

#-------------------------------------------------------
# Prefix and suffix
DEP=.d
OBJ = .
CMPLR_SUFFIX=
CMPLR_PREFIX=
LIB_PREFIX=
SHRLIB_PREFIX= $(LIB_PREFIX)

#--------------------------------------------------
# vpath directories
POSIX_YES = os/posix
GENERIC_SRC_DIRS = .. $(SRC_DIRS)
OS_SRC_DIRS += . $(foreach dir, .. $(SRC_DIRS), \
       $(addprefix $(dir)/, os/$(OS_CLASS) $(POSIX_$(POSIX)) os/default ))
ALL_SRC_DIRS = $(OS_SRC_DIRS) $(GENERIC_SRC_DIRS)

#--------------------------------------------------
# compile line include directories
INSTALL_INCLUDES += \
       -I$(INSTALL_INCLUDE)/os/$(OS_CLASS) \
       -I$(INSTALL_INCLUDE)
SRC_INCLUDES = -I$(COMMON_DIR) $(addprefix -I, $(wildcard $(ALL_SRC_DIRS)))

#--------------------------------------------------
# Target filename definitions
OBJSNAME = $(addsuffix $(OBJ),$(basename $(OBJS)))
PRODNAME = $(addsuffix $(EXE),$(basename $(PROD)))
TESTPRODNAME = $(addsuffix $(EXE),$(basename $(TESTPROD)))

SHRLIBNAME = $(SHRLIBNAME_$(SHARED_LIBRARIES))

JAVA =
JAR =

#--------------------------------------------------
# obj files

TARGET_OBJS =  $($*_OBJLIBS) $($*_LDOBJS) $(addsuffix $(OBJ),$(basename $($*_OBJS) $($*_SRCS)))

PRODUCT_OBJS = $(addsuffix $(OBJ),$(basename $(SRCS) $(USR_SRCS) $(PROD_SRCS) $(USR_OBJS) $(PROD_OBJS)))
PROD_LD_OBJS = $(USR_OBJLIBS) $(PROD_OBJLIBS) $(TARGET_OBJS) $(PRODUCT_OBJS)

LIBRARY_OBJS = $(addsuffix $(OBJ),$(basename $(SRCS) $(USR_SRCS) $(LIB_SRCS) $(LIBSRCS) $(USR_OBJS) $(LIB_OBJS)))
LIBRARY_LD_OBJS = $(USR_OBJLIBS) $(LIB_OBJLIBS) $(TARGET_OBJS) $(LIBRARY_OBJS)

#--------------------------------------------------
# WIN95/NT resource files

TARGET_RESS = $(if $(RES),$(addsuffix $(RES),$(basename $($*_RCS))),)

PROD_RESS = $(if $(RES),$(addsuffix $(RES),$(basename $(RCS) $(PROD_RCS))),)
PROD_LD_RESS = $(TARGET_RESS) $(PROD_RESS)

LIBRARY_RESS = $(if $(RES),$(addsuffix $(RES),$(basename $(RCS) $(LIB_RCS) $(LIBRARY_RCS))),)
LIBRARY_LD_RESS = $(TARGET_RESS) $(LIBRARY_RESS)

#--------------------------------------------------
# WIN95/NT source browser
PROD_BAF = $(addsuffix $(BAF), $(basename $(PROD)))
LIB_BAF=$(addsuffix $(BAF),$(basename $(LIBRARY)))

#--------------------------------------------------
# C preprocessor, compiler, and linker flag defaults

# Target architecture specific flags
ARCH_DEP_CPPFLAGS =
ARCH_DEP_CFLAGS =
ARCH_DEP_CXXFLAGS = $(ARCH_DEP_CFLAGS)
ARCH_DEP_LDFLAGS =
ARCH_DEP_LDLIBS =

# Target operating system specific flags
OP_SYS_CPPFLAGS =
OP_SYS_CFLAGS =
OP_SYS_CXXFLAGS = $(OP_SYS_CFLAGS)
OP_SYS_LDFLAGS =
OP_SYS_INCLUDES =

# Makefile specific flags
USR_INCLUDES =
USR_CFLAGS =
USR_CXXFLAGS =
USR_LDFLAGS =
USR_LIBS =
USR_CPPFLAGS =
USR_DBDFLAGS =
USR_ARFLAGS =

# Debug specific options
DEBUG_CPPFLAGS =
DEBUG_CFLAGS =
DEBUG_CXXFLAGS = $(DEBUG_CFLAGS)
DEBUG_LDFLAGS =
DEBUG_LDLIBS =

# Target specific options
TARGET_INCLUDES = $($(basename $@)_INCLUDES_$(T_A))
TARGET_CFLAGS = $($(basename $@)_CFLAGS_$(T_A))
TARGET_CXXFLAGS = $($(basename $@)_CXXFLAGS_$(T_A))
TARGET_CPPFLAGS = $($(basename $@)_CPPFLAGS_$(T_A))

TARGET_INCLUDES += $($(basename $@)_INCLUDES_$(OS_CLASS)) $($(basename $@)_INCLUDES)
TARGET_CFLAGS += $($(basename $@)_CFLAGS_$(OS_CLASS)) $($(basename $@)_CFLAGS)
TARGET_CXXFLAGS += $($(basename $@)_CXXFLAGS_$(OS_CLASS)) $($(basename $@)_CXXFLAGS)
TARGET_CPPFLAGS += $($(basename $@)_CPPFLAGS_$(OS_CLASS)) $($(basename $@)_CPPFLAGS)

TARGET_LDFLAGS = $($*_LDFLAGS)

# Warnings flags
WARN_CPPFLAGS = $(WARN_CPPFLAGS_$($(BUILD_CLASS)_WARN))
WARN_CFLAGS = $(WARN_CFLAGS_$($(BUILD_CLASS)_WARN))
WARN_CXXFLAGS = $(WARN_CXXFLAGS_$($(BUILD_CLASS)_WARN))

# Optimization flags
OPT_CPPFLAGS = $(OPT_CPPFLAGS_$($(BUILD_CLASS)_OPT))
OPT_CFLAGS = $(OPT_CFLAGS_$($(BUILD_CLASS)_OPT))
OPT_CXXFLAGS = $(OPT_CXXFLAGS_$($(BUILD_CLASS)_OPT))

# Static build flags
STATIC_CFLAGS = $(STATIC_CFLAGS_$(STATIC_BUILD))
STATIC_CXXCFLAGS = $(STATIC_CXXFLAGS_$(STATIC_BUILD))
STATIC_LDFLAGS = $(STATIC_LDFLAGS_$(STATIC_BUILD))
STATIC_LDLIBS = $(STATIC_LDLIBS_$(STATIC_BUILD))

#--------------------------------------------------
# cflags for shared library src files (from SHRLIB_CFLAGS)
LIBRARY_SRCS=$(basename $(foreach lib,$(LIBRARY) $(LOADABLE_LIBRARY),$($(lib)_OBJSNAME) $(LIBRARY_OBJS)))
LIBRARY_SRC_CFLAGS=$($(patsubst $*,SHRLIB,$(findstring $*,$(LIBRARY_SRCS)))_CFLAGS)

#--------------------------------------------------
# prefix, suffix, and ldflags for loadable shared libraries 
TARGET_LIB_LDFLAGS=$($(patsubst $*,LOADABLE_,$(findstring $*,$(LOADABLE_LIBRARY)))SHRLIB_LDFLAGS)
LOADABLE_SHRLIB_PREFIX=$(SHRLIB_PREFIX)
LOADABLE_SHRLIB_SUFFIX=$(SHRLIB_SUFFIX)

#--------------------------------------------------
# Command-line input support default
COMMANDLINE_LIBRARY = EPICS
OP_SYS_LDLIBS += $(LDLIBS_$(COMMANDLINE_LIBRARY))
OP_SYS_LDFLAGS += $(LDFLAGS_$(COMMANDLINE_LIBRARY))
RUNTIME_LDFLAGS += $(RUNTIME_LDFLAGS_$(COMMANDLINE_LIBRARY))

#--------------------------------------------------
# Flags

INCLUDES = -I. $(SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\
 $(TARGET_INCLUDES) $(USR_INCLUDES) $(OP_SYS_INCLUDES) $($(BUILD_CLASS)_INCLUDES)

CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\
 $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\
 $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)

CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS) $(DEBUG_CXXFLAGS)\
 $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS)\
 $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)

LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \
 $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\
 $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)

LDLIBS = \
 $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS) $(GNU_LDLIBS_$(GNU))

CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS)\
 $(OPT_CPPFLAGS) $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS)\
 $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
 $(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)

#--------------------------------------------------
# ar definition default
ARFLAGS =
ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $@  $(LIBRARY_LD_OBJS)

#--------------------------------------------------
# 'Munch' link-edit
MUNCH_CMD = $(LD) $(MUNCH_LDFLAGS) -o $@ $^

#--------------------------------------------------
# LEX default options
#
# Allow 8-bit characters
LEXOPT += -8
# Generate an "interactive" scanner, solves problems at EOF.
LEXOPT += -I

#--------------------------------------------------
# Build compile line here

PATH_FILTER = $(1)
COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(call PATH_FILTER,$(INCLUDES))
COMPILE.cpp = $(CCC) -c $(CPPFLAGS) $(CXXFLAGS) $(call PATH_FILTER,$(INCLUDES))

#--------------------------------------------------
# C preprocessor command
PREPROCESS.cpp = $(CPP) $(CPPFLAGS) $(INCLUDES) $< > $@

#--------------------------------------------------
# Header dependency file generation

HDEPENDS = YES
HDEPENDS_METHOD = CMD

HDEPENDS_INCLUDES = $(subst -I,,$(INCLUDES))
HDEPENDSFLAGS = -m $*$(DEP) $(HDEPENDS_INCLUDES) $@ $<
HDEPENDSCMD = -$(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDSFLAGS)

HDEPENDS_CMD_NO = $(ECHO) ""
HDEPENDS_CMD_YES = $(if $(filter CMD,$(HDEPENDS_METHOD)),$(HDEPENDSCMD),$(HDEPENDS_CMD_NO))
HDEPENDS_CMD = $(HDEPENDS_CMD_$(HDEPENDS))

HDEPENDSCFLAGS = -MMD
HDEPENDS_CFLAGS_YES = $(if $(filter CFLAGS,$(HDEPENDS_METHOD)),$(HDEPENDSCFLAGS))
HDEPENDS_CFLAGS = $(HDEPENDS_CFLAGS_$(HDEPENDS))

#--------------------------------------------------
# depends definition

TARGET_SRCS = $(foreach name, $(TESTPROD) $(PROD) $(LIBRARY), $($(name)_SRCS))
SRC_FILES = $(LIB_SRCS) $(LIBSRCS) $(SRCS) $(USR_SRCS) $(PROD_SRCS) $(TARGET_SRCS)
HDEPENDS_FILES_YES = $(addsuffix $(DEP),$(notdir $(basename $(SRC_FILES))))
HDEPENDS_FILES = $(if $(filter NO,$(HDEPENDS)),,$(HDEPENDS_FILES_YES))

#---------------------------------------------------------------
# Names of installed items
#
#	each list starts with the destination directory name(s)
#	to make sure it's there

INSTALL_PROD= $(PRODNAME:%= $(INSTALL_BIN)/%)
INSTALL_LIBS= $(LIBNAME:%=$(INSTALL_LIB)/%)
INSTALL_MUNCHS= $(MUNCHNAME:%=$(INSTALL_BIN)/%)
INSTALL_SHRLIBS= $(SHRLIBNAME:%=$(INSTALL_SHRLIB)/%)
INSTALL_LOADABLE_SHRLIBS= $(LOADABLE_SHRLIBNAME:%=$(INSTALL_SHRLIB)/%)
INSTALL_DLL_LINK_LIBS=$(DLL_LINK_LIBNAME:%=$(INSTALL_LIB)/%)
INSTALL_TCLLIBS=$(TCLLIBNAME:%=$(INSTALL_TCLLIB)/%)
INSTALL_TCLINDEX=$(TCLINDEX:%=$(INSTALL_TCLLIB)/%)
INSTALL_SCRIPTS = $(SCRIPTS:%= $(INSTALL_BIN)/%)
INSTALL_OBJS = $(OBJSNAME:%= $(INSTALL_BIN)/%)

INSTALL_DOCS = $(DOCS:%= $(INSTALL_DOC)/%)
INSTALL_HTMLS = $(HTMLS:%= $(INSTALL_HTML)/$(HTMLS_DIR)/%)

INSTALL_TEMPLATE = $(addprefix $(INSTALL_TEMPLATES_SUBDIR)/, \
                   $(subst $(CONFIG),top/configure,$(TEMPLATES)))
INSTALL_CONFIGS = $(CONFIGS:%= $(INSTALL_CONFIG)/%)

INSTALL_BIN_INSTALLS = $(addprefix $(INSTALL_BIN)/,$(notdir $(BIN_INSTALLS)))
INSTALL_LIB_INSTALLS = $(addprefix $(INSTALL_LIB)/,$(notdir $(LIB_INSTALLS)))

#---------------------------------------------------------------
# Installed file permissions
BIN_PERMISSIONS = 555
LIB_PERMISSIONS = 444
INSTALL_PERMISSIONS = 444

#---------------------------------------------------------------
#
# auto determine the directory paths that things are installed to
# RULES:
# 1) found in any one of several os specific area
#       => install to $(INSTALL_INCLUDE)/os/$(OS_CLASS)
# 2) not foundin (1) and found in generic area
#       => install to $(INSTALL_INCLUDE)
# 3) not found in (1) or (2) then may be (not yet) computer generated
#       => install into $(INSTALL_INCLUDE)/os/$(OS_CLASS) and let
#       build rules work on vpath
#
# These rules guarantee that the users include from
# no more than two directories
#
INSTALL_INC += $(foreach inc, $(INC), \
    $(firstword \
        $(OS_INSTALL_INC) \
        $(GENERIC_INSTALL_INC) \
        $(GENERATED_INSTALL_INC) ) )
INSTALL_INC += $(addprefix $(INSTALL_INCLUDE)/os/$(OS_CLASS)/, $(INC_$(OS_CLASS)) )

#
# Rule 1
#
OS_INSTALL_INC = $(addprefix $(INSTALL_INCLUDE)/os/$(OS_CLASS)/, $(INSTALL_INC_ggg) )
INSTALL_INC_ggg = $(foreach dir, $(OS_SRC_DIRS), $(INSTALL_INC_fff)  )
INSTALL_INC_fff = $(subst $(dir)/, , $(INSTALL_INC_eee) )
INSTALL_INC_eee = $(wildcard $(addsuffix /$(inc), $(dir)) )

#
# Rule 2
#
GENERIC_INSTALL_INC = $(addprefix $(INSTALL_INCLUDE)/, $(INSTALL_INC_ccc) )
INSTALL_INC_ccc = $(foreach dir, .. $(SRC_DIRS), $(INSTALL_INC_bbb)  )
INSTALL_INC_bbb = $(subst $(dir)/, , $(INSTALL_INC_aaa) )
INSTALL_INC_aaa = $(wildcard $(addsuffix /$(inc), $(dir)) )

#
# Rule 3
#
GENERATED_INSTALL_INC = $(INSTALL_INCLUDE)/$(inc)

COMMON_INC += $(filter $(COMMON_DIR)/%, $(foreach file, $(INC), \
    $(firstword  $(SOURCE_INC) $(COMMON_DIR)/$(file) ) ) )
SOURCE_INC = $(wildcard $(file) $(SOURCE_INC_bbb) )
SOURCE_INC_bbb = $(foreach dir, $(ALL_SRC_DIRS), $(SOURCE_INC_aaa)  )
SOURCE_INC_aaa = $(addsuffix /$(file), $(dir) )
 
endif
 
END 1.1.1.2.1 Back to 1.1.1.2
include $(CONFIG)/CONFIG_FILE_TYPE
 
1.1.1.2.2 Expansion of line include /global/develbuild/base/base-3.14.12.1/configure/CONFIG_FILE_TYPE is below.
#*************************************************************************
# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution. 
#*************************************************************************
# Revision-Id: [email protected]
#
# Macros and rules to create a new installation file type 
#

# --------------------------------------------------------------
# Module developers can now define a new type of file, e.g. ABC, 
# so that files of type ABC will be installed into a directory
# defined by INSTALL_ABC. This is done by creating a new CONFIG<name>
# file, e.g. CONFIG_ABC, with the following lines:
#
#       FILE_TYPE += ABC
#       INSTALL_ABC = $(INSTALL_LOCATION)/abc
#
# The INSTALL_ABC directory should be be a subdirectory of 
# $(INSTALL_LOCATION). The file type ABC should be target
# architecture independent (alh files, medm files, edm files).
#
# Optional rules necessary for files of type ABC should be put in
# a RULES_ABC file.
#
# The module developer installs new CONFIG* or RULES* files
# into the directory $(INSTALL_LOCATION)/cfg by including the 
# following Makefile line:
#
#       CFG += CONFIG_ABC RULES_ABC
# 
# Files of type ABC are installed into INSTALL_ABC directory
# by adding a line like the following to a Makefile.
#
#       ABC += <filename1> <filename2> <filename3>
#
# Files in $(INSTALL_LOCATION)/cfg directory are now included by
# the base config files so the definitions and rules are available
# for use by later src directory Makefiles in the same module or
# by other modules with a RELEASE line pointing to the TOP of 
# the module with RULES_ABC.

FILE_TYPE += ADL
INSTALL_ADL = $(INSTALL_LOCATION)/adl

FILE_TYPE += ALH
INSTALL_ALH = $(INSTALL_LOCATION)/alh

FILE_TYPE += CFG
INSTALL_CFG = $(INSTALL_LOCATION)/cfg

FILE_TYPE += EDL
INSTALL_EDL = $(INSTALL_LOCATION)/edl

FILE_TYPE += PERL_MODULES
INSTALL_PERL_MODULES = $(INSTALL_LOCATION_LIB)/perl

INSTALLS_CFG= $(CFG:%= $(INSTALL_CFG)/%)
DIRECTORY_TARGETS += $(foreach type, $(FILE_TYPE),$(INSTALL_$(type)))

 
END 1.1.1.2.2 Back to 1.1.1.2

#  Base-specific build options
#
include $(CONFIG)/CONFIG_BASE

#  Site-specific build options
#
include $(CONFIG)/CONFIG_SITE

#  Version numbering
#
include $(CONFIG)/CONFIG_BASE_VERSION

#  Host architecture specific definitions
#
include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common

ifdef T_A

#  Cross compile specific definitions
#
ifneq ($(EPICS_HOST_ARCH),$(T_A))
include $(CONFIG)/CONFIG.CrossCommon
endif

#  Target architecture specific definitions
#
-include $(CONFIG)/os/CONFIG.Common.$(T_A)

#  Host-Target architecture specific definitions
#
-include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).$(T_A)

#  RELEASE file specific definitions
#
ifneq ($(CONFIG),$(TOP)/configure)
-include $(CONFIG)/CONFIG_APP_INCLUDE
endif

#  Site specific target and host-target definitions
#
-include $(CONFIG)/os/CONFIG_SITE.Common.$(T_A)
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)

endif

# Include <top>/cfg/CONFIG* definitions from tops defined in RELEASE* files
#
ifneq ($(CONFIG),$(TOP)/configure)
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/CONFIG*))
ifneq ($(RELEASE_CFG_CONFIGS),)
include $(RELEASE_CFG_CONFIGS)
endif
endif

# Include $(INSTALL_CFG)/CONFIG* definitions
#
ifndef T_A
TOP_CFG_CONFIGS = $(wildcard $(INSTALL_CFG)/CONFIG*)
ifneq ($(TOP_CFG_CONFIGS),)
include $(TOP_CFG_CONFIGS)
endif
endif

#  User specific definitions
#
-include $(HOME)/configure/CONFIG_USER
-include $(HOME)/configure/CONFIG_USER.$(EPICS_HOST_ARCH)
ifdef T_A
-include $(HOME)/configure/CONFIG_USER.Common.$(T_A)
-include $(HOME)/configure/CONFIG_USER.$(EPICS_HOST_ARCH).$(T_A)
endif

#  All options
#   may be overridden here.
#
# EXAMPLES
# --------
#  Build client objects statically ?  must be either YES or NO
#STATIC_BUILD=NO
#  Host build optimization,   must be either YES or NO
#HOST_OPT=YES
#  Cross build optimization,  must be either YES or NO
#CROSS_OPT=YES
#  Generate Verbose Compiler Warnings for host build,  must be either YES or NO
#HOST_WARN=YES
#  Generate Verbose Compiler Warnings for cross compile builds,  must be either YES or NO
#CROSS_WARN=YES
#etc.

#CROSS_COMPILER_TARGET_ARCHS=vxWorks-68040
 
END 1.1.1.2 Manual expansion of included file. Back to level 1.1.1

INSTALL_LOCATION = $(TOP)
ifdef INSTALL_LOCATION_APP
INSTALL_LOCATION = $(INSTALL_LOCATION_APP)
endif

ifdef T_A
-include $(TOP)/configure/O.$(T_A)/CONFIG_APP_INCLUDE
endif

# dbst based database optimization (default: NO)
DB_OPT = NO
 

END 1.1.1 Manual expansion of included file. Back to level 1.1

# Add any changes to make definitions here

#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040

# Use this when your IOC and the host use different paths
# to access the application. Typically this will be 
# used with the Microsoft FTP server or with NFS mounts. Use
# is indicated by failure of the cdCommands script on
# vxWorks. You must rebuild in the iocBoot directory 
# before this takes effect.
#IOCS_APPL_TOP = <the top of the application as seen by the IOC>

 

END 1.1 Manual expansion of included file. Back to level 1

DIRS := $(DIRS) $(filter-out $(DIRS), configure)
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *App))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *app))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocBoot))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocboot))
include $(TOP)/configure/RULES_TOP
 

END 1 Manual expansion of top makefile.