# Makefile.head -- the initial portion of a generic makefile # framework to be included at the top directory of each component. # # Before including this file, the TOP variable should be set to the # absolute path of the top-level project directory, and the COMP # variable should be set to the path to the component's top-level # directory, relative to the project's top-level directory. After # including this file, include the directory makefiles, and then # include Makefile.tail. Before including Makefile.tail, TARGETS # should be set to the default targets to be made when "make" is # invoked with no arguments. The target rules themselves can be # declared after Makefile.tail in order to use variables such as OBJS # which are set in Makefile.tail. # # WARNING: These makefiles will not work if you have spaces in any # pathnames, including any parent directory outside the project # hierarchy. This is a limitation of GNU make (quoting things # doesn't help). Sorry. # # The makefiles also probably won't work very well if the component # directory is a symlink, and the top-level directory is the symbolic # parent (i.e. dirname `pwd -L`) rather than the physical parent # (i.e. dirname `pwd -P`). # # NOTE: due to suckage of make that I haven't figured out how to work # around, you'll have to run make twice after you update a .cdl file # in order to make sure that any code that includes the generated # headers has been rebuilt. This is despite having an explicit # dependency of the .cc file on the normal .h, of the normal .h on # the generated .h, of the generated headers on the server directory, # and of the server directory on the CDL file. The CDL->directory # rule is used to generated the headers, but even if it's done # specifically for the .cc file up the chain, it doesn't rebuild the # .cc file. TARGET := $(TOP)/Makefile.target ifeq ($(TARGET),$(wildcard $(TARGET))) include $(TARGET) endif CXXINCS += -I$(TOP)/include/c++ -I$(GENINCLUDES)/c++ \ -I$(TOP)/include/c -I$(TOP)/include/c/std \ -I$(BUILDDIR)/include CINCS += -I$(TOP)/include/c -I$(TOP)/include/c/std \ -I$(BUILDDIR)/include WARN += -Wall -Werror OPT += -O2 DEBUG += -g3 TFLAGS += -freg-struct-return # Target and ABI flags ifeq ($(V),) V := @ else override V := endif CXXFLAGS += $(DEFS) $(CXXINCS) $(CXXWARN) $(OPT) $(DEBUG) $(TFLAGS) BUILDCXXFLAGS += $(BUILDDEFS) $(CXXWARN) $(OPT) $(DEBUG) CFLAGS += $(CINCS) $(DEFS) $(CWARN) $(OPT) $(DEBUG) $(TFLAGS) BUILDCFLAGS += $(BUILDDEFS) $(CWARN) $(OPT) $(DEBUG) ASFLAGS += $(TFLAGS) LDFLAGS += $(TFLAGS) .PHONY: all default rerun dep servers clean distclean .SUFFIXES: all: default # Make sure "make" treats thse as the right type of variable # when += is used later. DIRS := CFILES := CXXFILES := ASFILES := GENCFILES := GENCXXFILES := GENASFILES := BUILDCFILES := BUILDCXXFILES := BUILDGENCFILES := BUILDGENCXXFILES :=