# -*- Makefile -*-
#----------------------------------------------------------------------------
#       GNU Makefile
#
# @file <%project_file%>
#
# This file was automatically generated by MPC.  Any changes made directly to
# this file will be lost the next time it is generated.
#
#----------------------------------------------------------------------------
<%marker(top)%>
MAKEFILE         = <%project_file%>
DEPENDENCY_FILE  = .depend.<%project_name%>
<%if(compares(build_dir_per_project, 1))%>
VDIR_PRJ = <%project_name%>/
<%endif%>
<%if(idl_files)%>

<%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%>
<%foreach(idl_files)%>
IDL_DEPENDENCY_FILE<%forcount%> = .depend.<%project_name%>_Idl<%forcount%>
<%endfor%>

IDL_DEPENDENCY_FILES += \
<%foreach(idl_files)%>
	.depend.<%project_name%>_Idl<%forcount%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
<%endif%>
<%if(exename)%>
BIN_UNCHECKED    = <%exename%>
<%endif%>

LIB_PREFIX      ?= lib
<%if(need_staticflags)%>
static_libs_only ?= 1
<%endif%>
<%if(staticname)%>

## LIB_CHECKED may be set to empty later on in this file
LIB_UNCHECKED    = $(LIB_PREFIX)<%libname_prefix%><%staticname%>.$(LIBEXT)
LIB_CHECKED      = $(LIB_UNCHECKED)
LIB_NAME         = $(LIB_PREFIX)<%libname_prefix%><%staticname%>
<%if(!sharedname)%>
static_libs_only = 1
<%endif%>
<%endif%>
<%if(sharedname)%>

## SHLIB may be set to empty later on in this file
SHLIB_UNCHECKED  = $(LIB_PREFIX)<%libname_prefix%><%sharedname%>.$(SOEXT)
SHLIB            = $(SHLIB_UNCHECKED)
<%endif%>
<%if(tao || ciao || dance)%>

TAO_ROOT  ?= $(ACE_ROOT)/TAO
<%if(ciao)%>
CIAO_ROOT ?= $(TAO_ROOT)/CIAO
<%endif%>
<%if(dance)%>
DANCE_ROOT ?= $(TAO_ROOT)/DAnCE
<%endif%>
<%endif%>

<%if(grouped_source_files)%>
<%foreach(grouped_source_files)%>
<%grouped_source_file%> = \
<%foreach(uniq(grouped_source_file->files))%>
  <%grouped_source_file->file%><%fornotlast(" \\")%>
<%endfor%>

<%endfor%>
FILES += \
<%foreach(grouped_source_files)%>
         $(<%grouped_source_file%>)<%fornotlast(" \\")%>
<%endfor%>

<%else%>
FILES = \
<%foreach(uniq(source_files))%>
  <%source_file%><%fornotlast(" \\")%>
<%endfor%>

<%endif%>
<%if(idl_files)%>
<%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%>
<%foreach(idl_files)%>
IDL_DEPS_FLAGS<%forcount%> = <%if(flag_overrides(idl_file, commandflags))%><%flag_overrides(idl_file, commandflags)%><%else%><%idlflags%><%endif%>
IDL_DEPS<%forcount%> = <%idl_file%>

<%endfor%>
<%endif%>

<%endif%>
<%vpath%>

LIBPATHS := <%libpaths%>

#----------------------------------------------------------------------------
#       Include macros and targets
#----------------------------------------------------------------------------
<%marker(macros)%>
<%if(xerceslib)%>
XERCESLIB ?= <%xerceslib%>
<%endif%>
<%if(exename)%>
LDLIBS =<%foreach(libs)%> -l<%libname_prefix%><%lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%>
<%else%>
<%if(sharedname)%>
ACE_SHLIBS =<%foreach(libs)%> -l<%libname_prefix%><%lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%>
<%endif%>
<%endif%>
<%if(tao_idl)%>
TAO_IDL = <%tao_idl%>
<%endif%>
<%if(tao_idl_dep)%>
TAO_IDL_DEP = <%tao_idl_dep%>$(EXEEXT)
<%endif%>
<%if(tao_idlflags)%>
TAO_IDLFLAGS = <%tao_idlflags%><%if(!compares(vms_old_make, 1))%>$(if $(ARCH), -g $(call ADD_QUOTE,$(call ADD_ARCH,$(ACE_ROOT)/bin/ace_gperf)))<%endif%>
<%endif%>
<%if(xsc_bin)%>
XSC_BIN = <%xsc_bin%>
<%endif%>
<%if(xsc_dep)%>
XSC_DEP = <%xsc_dep%>$(EXEEXT)
<%endif%>
<%if(xsc_flags)%>
XSC_FLAGS = <%xsc_flags%>
<%endif%>
<%if(tao_idl3_to_idl2)%>
TAO_IDL3_TO_IDL2 = <%tao_idl3_to_idl2%>
<%endif%>
<%if(tao_idl3_to_idl2_dep)%>
TAO_IDL3_TO_IDL2_DEP = <%tao_idl3_to_idl2_dep%>$(EXEEXT)
<%endif%>
<%if(tao_idl3toidl2flags)%>
TAO_IDL3_TO_IDL2_FLAGS = <%tao_idl3toidl2flags%>
<%endif%>
<%if(tao_idl3_to_xmi)%>
TAO_IDL3_TO_XMI = <%tao_idl3_to_xmi%>
<%endif%>
<%if(tao_idl3_to_xmi_dep)%>
TAO_IDL3_TO_XMI_DEP = <%tao_idl3_to_xmi_dep%>$(EXEEXT)
<%endif%>
<%if(tao_idl3toxmiflags)%>
TAO_IDL3_TO_XMI_FLAGS = <%tao_idl3toxmiflags%>
<%endif%>

<%if(exename)%>
PRJ_TYPE = rtp
<%else%>
PRJ_TYPE = library
<%endif%>

<%if(exename)%>
<%if(install)%>
COLLAPSE_SLASHES = $(if $(findstring //,$(1)),$(call COLLAPSE_SLASHES,$(subst //,/,$(1))),$(1))
INSBIN ?= <%if(compares(vms_old_make, 1))%><%install%><%else%>$(call COLLAPSE_SLASHES,<%install%>)<%endif%>
<%endif%>
ifeq ($(INSBIN),.)
  ifeq ($(CURDIR),)
    ifeq ($(PWD),)
      PWD=$(shell pwd)
    endif
  else
    PWD=$(CURDIR)
  endif
  INSBIN = $(PWD)<%if(targetoutdir)%>/<%targetoutdir%><%endif%>
<%if(targetoutdir)%>
else
  ifneq ($(INSBIN),)
    INSBIN := $(INSBIN)/<%targetoutdir%>
  endif
<%endif%>
endif
<%if(install)%>
OUTPUT_DIRECTORY = $(if $(ARCH),$(if $(INSBIN),$(INSBIN)/$(ARCH)),$(INSBIN))
<%else%>
OUTPUT_DIRECTORY = $(if $(ARCH),./$(ARCH))
<%endif%>
<%else%>
<%if(dllout || libout)%>
COLLAPSE_SLASHES = $(if $(findstring //,$(1)),$(call COLLAPSE_SLASHES,$(subst //,/,$(1))),$(1))
INSLIB ?= <%if(compares(vms_old_make, 1))%><%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%else%>$(call COLLAPSE_SLASHES,<%if(dllout)%><%dllout%><%else%><%libout%><%endif%>)<%endif%>
<%endif%>
ifeq ($(INSLIB),.)
  ifeq ($(CURDIR),)
    ifeq ($(PWD),)
      PWD=$(shell pwd)
    endif
  else
    PWD=$(CURDIR)
  endif
  INSLIB = $(PWD)<%if(targetoutdir)%>/<%targetoutdir%><%endif%>
<%if(targetoutdir)%>
else
  INSLIB := $(INSLIB)/<%targetoutdir%>
<%endif%>
endif
OUTPUT_DIRECTORY = $(INSLIB)
<%endif%>

<%if(targetoutdir)%>
VDIR   = <%targetoutdir%>.obj/
VSHDIR = <%targetoutdir%>.shobj/

<%endif%>
include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU

<%marker(extension)%>
<%if(ciao)%>
include $(CIAO_ROOT)/rules.ciao.GNU
<%endif%>
<%if(dance)%>
include $(DANCE_ROOT)/rules.dance.GNU
<%endif%>
<%if(tao)%>
include $(TAO_ROOT)/rules.tao.GNU
<%endif%>

<%if(version)%>
GNUACE_PROJECT_VERSION = <%version%>
<%else%>
GNUACE_PROJECT_VERSION ?= $(ACE_VERSION)
<%endif%>

<%if(resource_files)%>
ifneq (,$(RC))
RESOURCES += \
<%foreach(resource_files)%>
  <%resource_file%><%fornotlast(" \\")%>
<%endfor%>
<%if(includes)%>

RC_INCLUDE_FLAG ?= --include-dir=
RCFLAGS = \
<%foreach(includes)%>
        $(RC_INCLUDE_FLAG)<%include%><%fornotlast(" \\")%>
<%endfor%>
<%endif%>
endif

<%endif%>
# To build multiple targets in the same directory on AIX, it works
# best to have a template directory per project.
# The compiler/linker isn't too smart about instantiating templates...
ifdef TEMPINCDIR
TEMPINCDIR := $(TEMPINCDIR)/<%project_name%>
all: $(TEMPINCDIR)
endif

ifneq ($(OUTPUT_DIRECTORY),)
.PHONY: create_output_directory.local
all: create_output_directory.local
create_output_directory.local:
	-@$(MKDIR) "$(OUTPUT_DIRECTORY)" $(ACE_NUL_STDERR)
endif

<%if(sharedname || staticname || exename)%>
<%if(libs && libpaths)%>
# turn off libcheck if doing a dry run
ifeq ($(findstring n, $(MAKEFLAGS)),n)
  LIBCHECK = 1
else
  # turn off libcheck if keep going was passed too
  ifeq ($(findstring k, $(MAKEFLAGS)),k)
    LIBCHECK = 1
  else
    ifeq ($(LIBCHECK_PREFIX),)
      # If the user hasn't specified a place to look for installed libraries, let's set
      # a reasonable default
      LIBCHECK_PREFIX = /usr
    endif
    LIBCHECK ?= $(filter-out $(foreach lib,<%foreach(libs)%><%libname_prefix%><%lib%><%fornotlast(" ")%><%endfor%>,$(findstring $(lib),$(foreach libpath,<%foreach(libpaths)%><%if(targetoutdir)%><%libpath%>/<%targetoutdir%> <%endif%><%libpath%> $(if $(ARCH),<%libpath%>/$(ARCH)) <%endfor%>$(LIBCHECK_PREFIX)/lib $(LIBCHECK_PREFIX)/lib64 $(LIBCHECK_EXTRA_PATHS) $(INSLIB),$(wildcard $(libpath)/$(LIB_PREFIX)$(lib).* $(libpath)/$(lib).lib)))),<%foreach(libs)%><%libname_prefix%><%lib%><%fornotlast(" ")%><%endfor%>)
    ifeq ($(LIBCHECK),)
      LIBCHECK = 1
    endif
  endif
endif
<%else%>
LIBCHECK = 1
<%endif%>
<%else%>
LIBCHECK = 1
<%endif%>
<%if(!exename)%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
ifneq ($(LIBCHECK), 1)
<%if(staticname)%>
  LIB_CHECKED   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: lib_warning
endif
<%foreach(avoids)%>
else
<%if(staticname)%>
  LIB_CHECKED   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
<%if(staticname)%>
  LIB_CHECKED   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: require_warning
endif
<%endfor%>

<%if(tagname)%>
ifeq (,$(<%tagname%>))
<%endif%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
<%foreach(avoids)%>
else
<%if(staticname)%>
  LIB_CHECKED   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
<%if(staticname)%>
  LIB_CHECKED   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: require_warning
endif
<%endfor%>
<%if(tagname)%>
else
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
<%foreach(tagchecks)%>
  ifeq (<%tagcheck%>, $(findstring <%tagcheck%>, $(<%tagname%>)))
<%endfor%>
<%foreach(tagchecks)%>
  else
    LIB_CHECKED   =
    SHLIB =
  endif
<%endfor%>
<%foreach(avoids)%>
else
  LIB_CHECKED   =
  SHLIB =
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
  LIB_CHECKED   =
  SHLIB =
  all: require_warning
endif
<%endfor%>
endif
<%endif%>
<%endif%>
<%if(exename)%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
ifeq ($(LIBCHECK), 1)
BIN    = $(BIN_UNCHECKED)$(EXEEXT)
ifdef ARCH
  ARCH_BIN = $(ARCH)/$(BIN)
endif #ARCH
else
  all: lib_warning
endif
<%foreach(avoids)%>
else
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
  all: require_warning
endif
<%endfor%>

# If it contains ../ at all use notdir.
OBJS   = $(foreach var, $(addsuffix .$(OBJEXT), $(basename $(FILES)) $(RESOURCES)), $(if $(findstring ../,$(var)),$(notdir $(var)),$(var)))
SRC    = $(FILES)
<%endif%>
<%if(sharedname || staticname)%>
LSRC   = $(FILES)
<%endif%>

<%marker(circuit)%>
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
<%if(exename)%>

ifneq ($(INSBIN),)
ifneq ($(INSBIN),.)
  INSTALL = $(VBIN:%=$(INSBIN)/%)
  CLEANUP_INSTALL += $(CLEANUP_BIN:%=$(INSBIN)/$(if $(ARCH),$(ARCH)/)%$(VAR)$(EXEEXT))
endif
endif

<%endif%>
<%if(sharedname || staticname)%>
include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
<%endif%>
<%if(pch_source)%>

ACE_PCH_SOURCE = <%pch_source%>
ACE_PCH_FILE   = <%basename(pch_header)%>.gch

ifeq ($(pchsupport),1)
<%if(pch_defines)%>
CPPFLAGS +=<%foreach(pch_defines)%> -D<%pch_define%><%endfor%>
<%endif%>

$(addprefix $(VDIR), $(OBJS)): $(VDIR)$(ACE_PCH_FILE)
$(VSHOBJS): $(VSHDIR)$(ACE_PCH_FILE)
endif

<%endif%>
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
ifeq ($(VXWORKSLINK),1)
include $(TGT_DIR)/h/make/rules.$(PRJ_TYPE)
endif

<%foreach(source_files)%>
<%if(flag_overrides(source_file, buildflags))%>
$(VDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%>
	@$(MKDIR) $(VDIR)<%dirname(source_file)%>
	<%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%flag_overrides(source_file, buildflags)%> $(ACE_USE_PCH_OPT) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $<
	${MVCMD}

ifneq ($(VSHDIR), $(VDIR))
$(VSHDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%>
	@$(MKDIR) $(VSHDIR)<%dirname(source_file)%>
	<%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%flag_overrides(source_file, buildflags)%> $(ACE_USE_PCH_OPT) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $<
endif

<%else%>
<%if(dirname(source_file) && !contains(source_file, \.\./))%>
<%if(starts_with(source_file, \$) || !ends_with(source_file, \.cpp))%>
$(VDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%>
	@$(MKDIR) $(VDIR)<%dirname(source_file)%>
	<%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%if(flag_overrides(source_file, buildflags))%><%flag_overrides(source_file, buildflags)%> <%endif%>$(ACE_USE_PCH_OPT) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $<
	${MVCMD}

ifneq ($(VSHDIR), $(VDIR))
$(VSHDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%>
	@$(MKDIR) $(VSHDIR)<%dirname(source_file)%>
	<%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%if(flag_overrides(source_file, buildflags))%><%flag_overrides(source_file, buildflags)%> <%endif%>$(ACE_USE_PCH_OPT) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $<
endif

<%endif%>
<%endif%>
<%endif%>
<%endfor%>
<%if(libpaths)%>
ifeq ($(VXWORKSLINK),1)
LDLIBPATH     =<%foreach(libpaths)%> <%if(targetoutdir)%>-L<%libpath%>/<%targetoutdir%> <%endif%>-L<%libpath%><%endfor%><%if(linkflags)%> <%linkflags%><%endif%>
else
LDFLAGS      +=<%foreach(libpaths)%> <%if(targetoutdir)%>-L<%libpath%>/<%targetoutdir%> <%endif%>-L<%libpath%> $(if $(ARCH),-L<%libpath%>/$(ARCH))<%endfor%><%if(linkflags)%> <%linkflags%><%endif%>
endif
<%endif%>
<%if(includes)%>
CPPFLAGS     +=<%foreach(includes)%> -I<%include%><%endfor%>
<%endif%>
<%if(macros)%>
CPPFLAGS     +=<%foreach(macros)%> -D<%macro%><%endfor%>
<%endif%>
<%if(compile_flags)%>
CPPFLAGS     += <%compile_flags%>
<%endif%>
<%if(dynamicflags)%>
ifeq ($(shared_libs),1)
  ifneq ($(SHLIB),)
    CPPFLAGS +=<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%>
  endif
endif
<%endif%>
<%if(staticflags || exename)%>
ifeq ($(static_libs),1)
<%if(staticflags)%>
  CPPFLAGS +=<%foreach(staticflags)%> -D<%staticflag%><%endfor%>
<%endif%>
<%if(exename)%>
  ifeq ($(link_groups), 1)
    LDLIBS := -Wl,--start-group $(LDLIBS) -Wl,--end-group
  endif
<%endif%>
endif
<%endif%>

#----------------------------------------------------------------------------
#       Local targets
#----------------------------------------------------------------------------
<%marker(local)%>
.PHONY: lib_warning
lib_warning:
	@echo <%project_name%> will not be built due to the following missing library: $(LIBCHECK) >&2

<%if(requires)%>
<%foreach(requires)%>
ifneq ($(<%require%>),1)
requires_disabled_macros += <%require%>
endif
<%endfor%>
.PHONY: require_warning
require_warning:
	@echo <%project_name%> will not be built due to the following disabled make macros: $(requires_disabled_macros)>&2

<%endif%>
<%if(avoids)%>
<%foreach(avoids)%>
ifeq ($(<%avoid%>),1)
avoids_enabled_macros += <%avoid%>
endif
<%endfor%>
.PHONY: avoid_warning
avoid_warning:
	@echo <%project_name%> will not be built due to the following enabled make macros: $(avoids_enabled_macros)>&2

<%endif%>
<%if(custom_types)%>
## Some OS's have /bin/test others only have /usr/bin/test
ifeq ($(wildcard /bin/test), /bin/test)
  TEST_EXE = /bin/test
else
ifeq ($(wildcard /usr/bin/test), /usr/bin/test)
  TEST_EXE = /usr/bin/test
endif
endif

SPACE = $(should_be_unset) $(should_be_unset)
<%foreach(custom_types)%>
<%if(custom_type->libpath)%>
export DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH))
export LD_LIBRARY_PATH   := $(LD_LIBRARY_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH))
export SHLIB_PATH        := $(SHLIB_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH))
export LIBPATH           := $(LIBPATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH))
export PATH              := $(PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH))

<%endif%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>
GENERATED_DIRTY +=<%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%>
<%if(custom_type->input_file->non_source_output_files)%>
OBJS_DEPEND_ON_GENERATED = 1
<%endif%>
<%foreach(custom_type->input_file->output_files)%>
<%if(forlast && !forfirst)%>
## More than one file is generated by the command and therefore
## it can not be run in parallel.  Unfortunately, there is no way to
## say that only this rule can't be run in parallel.  However, we can
## determine if the generated files have already been generated.  If that's
## the case, then we don't need this special rule.
ifeq ($(wildcard $(GENERATED_DIRTY)), $(GENERATED_DIRTY))
  ## If we can find /bin/test, then we will continue
  ifneq ($(TEST_EXE),)
    ## If all of the generated files are there, then we need to check
    ## and make sure that the generated files are up-to-date.  If they are not
    ## then we need the special rule.
    ifeq ($(shell<%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%custom_type->input_file%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%> echo 0),)
      .NOTPARALLEL:
<%if(flag_overrides(custom_type->input_file, dependent) || custom_type->dependent || flag_overrides(custom_type->input_file, dependent_libs) || custom_type->dependent_libs)%>
    else
      ## By this point, all of the generated files are here and up-to-date
      ## with respect to the source file.  Now we need to make sure that
      ## they are up-to-date with respect to the generation tool.  If the tool
      ## is newer than the generated files, then we need the special rule.
      ifeq ($(shell<%if(flag_overrides(custom_type->input_file, dependent))%><%foreach(dep, flag_overrides(custom_type->input_file, dependent))%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%else%><%if(custom_type->dependent)%><%foreach(custom_type->dependent)%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%endif%><%endif%><%if(flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(dep_lib, flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%else%><%if(custom_type->dependent_libs)%><%foreach(custom_type->dependent_libs)%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%endif%><%endif%> echo 0),)
        .NOTPARALLEL:
      endif
<%endif%>
    endif
  else
    .NOTPARALLEL:
  endif
else
.NOTPARALLEL:
endif
<%endif%>
<%endfor%>
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->input_file->dependencies)%><%foreach(custom_type->input_file->dependencies)%> <%if(contains(custom_type->input_file->dependencie, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%custom_type->input_file->dependencie%>)<%else%><%custom_type->input_file->dependencie%><%endif%><%endfor%><%endif%><%if(flag_overrides(custom_type->input_file, dependent))%><%foreach(dep, flag_overrides(custom_type->input_file, dependent))%> <%if(contains(dep, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%><%endif%><%endfor%><%else%><%if(custom_type->dependent)%><%foreach(custom_type->dependent)%> <%if(contains(custom_type->dependent, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%><%endif%><%endfor%><%endif%><%endif%>
<%if(flag_overrides(custom_type->input_file, gendir))%>
<%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%>
	$(MKDIR) <%flag_overrides(custom_type->input_file, gendir)%>
<%endif%>
<%endif%>
	<%if(compares(vms_old_make, 1))%><%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%><%else%>$(if $(findstring ",<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>),<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>,$(call ADD_QUOTE,$(call ADD_ARCH,<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>)))<%endif%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%if(custom_type->output_option)%><%custom_type->input_file%> <%custom_type->output_option%> $@<%else%><%custom_type->input_file%><%endif%>
<%if(flag_overrides(custom_type->input_file, postcommand))%>
<%foreach(custom_type->input_file)%>
	<%flag_overrides(custom_type->input_file, postcommand)%>
<%endfor%>
<%else%>
<%if(custom_type->postcommand)%>
<%foreach(custom_type->input_file)%>
	<%custom_type->postcommand%>
<%endfor%>
<%endif%>
<%endif%>
<%if(pch_header)%>
<%if(custom_type->pch_postrule)%>
<%foreach(custom_type->input_file->source_output_files)%>
	@echo '#include "<%pch_header%>"' > temp.$$$$ && cat <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> >> temp.$$$$ && mv temp.$$$$ <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>
<%endfor%>
<%endif%>
<%endif%>

<%if(flag_overrides(custom_type->input_file, dependent_libs) || custom_type->dependent_libs)%>
ifneq ($(static_libs_only),1)
ifneq ($(CROSS-COMPILE),1)
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>:<%if(flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(dep_lib, flag_overrides(custom_type->input_file, dependent_libs))%> <%if(contains(dep_lib, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%><%endif%><%endfor%><%else%><%if(custom_type->dependent_libs)%><%foreach(custom_type->dependent_libs)%> <%if(contains(custom_type->dependent_lib, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%><%endif%><%endfor%><%endif%><%endif%>
endif
endif
<%endif%>

<%endif%>
<%endfor%>
<%endfor%>
ifneq ($(GENERATED_DIRTY),)
.PRECIOUS: $(GENERATED_DIRTY)
<%if(source_files)%>
## If the generated files are anything but source files, we need to
## ensure that those files are generated before we attempt to build anything
## else.
ifeq ($(OBJS_DEPEND_ON_GENERATED),1)
$(VDIR)$(ACE_PCH_FILE) $(addprefix $(VDIR), $(OBJS)): $(GENERATED_DIRTY)
$(VSHDIR)$(ACE_PCH_FILE) $(VSHOBJS): $(GENERATED_DIRTY)
endif
<%else%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
all: $(GENERATED_DIRTY)
<%foreach(avoids)%>
endif
<%endfor%>
<%foreach(requires)%>
endif
<%endfor%>
<%endif%>
endif

<%endif%>
<%if(idl_files)%>
ADDITIONAL_IDL_TARGETS += $(GENERATED_DIRTY)
idl_stubs: $(ADDITIONAL_IDL_TARGETS)
<%if(source_files)%>

# This assignment forces make to run the idl_stubs
# target before building any of the source files.
FORCED_IDL_STUBS = <%source_files%>  <%if(pch_source)%>$(ACE_PCH_SOURCE)<%endif%>
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->source_output_files)%>
<%foreach(custom_type->input_file->source_output_files)%>
FORCED_IDL_STUBS := $(FORCED_IDL_STUBS:<%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>=)
<%endfor%>
<%endif%>
<%endfor%>
<%endfor%>

ifneq ($(FORCED_IDL_STUBS),)
$(FORCED_IDL_STUBS): idl_stubs
endif
<%endif%>
<%endif%>
<%if(exename)%>

ifneq ($(VXWORKSLINK),1)
<%if(libs && libpaths)%>
ifeq ($(static_libs_only), 1)
  ifeq ($(use_dep_libs), 1)
    DEPLIBS = $(foreach lib,<%foreach(libs)%> <%libname_prefix%><%lib%><%endfor%> <%lit_libs%>, $(foreach libpath,<%foreach(libpaths)%><%if(targetoutdir)%> <%libpath%>/<%targetoutdir%><%endif%> <%libpath%><%endfor%>, $(wildcard $(libpath)/$(LIB_PREFIX)$(lib).$(LIBEXT))))
  endif
endif

<%endif%>
$(VBIN): $(addprefix $(VDIR), $(OBJS)) $(DEPLIBS)
  ifneq (,$(LINK.cc.override))
	$(LINK.cc.override)
  else
	$(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $(filter-out %.a,$^) $(VLDLIBS) $(POSTLINK)
  endif
endif
<%endif%>

<%if(idl_files)%>
<%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%>
incremental_depend_idl::
<%foreach(idl_files)%>
	@$(RM) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old
	@cp $(IDL_DEPENDENCY_FILE<%forcount%>) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old
	$(DEPGEN_ENV) $(DEPGEN) -A $(DEPEND_CMD_ARGS) -f $(IDL_DEPENDENCY_FILE<%forcount%>) \
	$(IDL_DEPS_FLAGS<%forcount%>) -t gnuidl -DMAKEDEPEND $(IDL_DEPS<%forcount%>)
	@if cmp -s $(IDL_DEPENDENCY_FILE<%forcount%>) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old ;\
	then echo "GNUmakefile idl dependencies unchanged for $(IDL_DEPS<%forcount%>)." ;\
	else \
		echo "GNUmakefile idl dependencies updated for $(IDL_DEPS<%forcount%>)." ;\
	fi ;\
	$(RM) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old ;
<%endfor%>
<%endif%>
<%endif%>

realclean: clean
ifneq ($(GENERATED_DIRTY),)
	-$(RM) -r $(GENERATED_DIRTY)
endif
<%if(postclean)%>
	-<%eval(postclean)%>
<%endif%>

__prebuild__:
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
<%if(prebuild)%>
	@<%eval(prebuild)%>
<%else%>
	@-:
<%endif%>
<%foreach(avoids requires)%>
endif
<%endfor%>

<%if(postbuild)%>
all: __postbuild__

<%if(exename)%>
__postbuild__: $(VBIN) $(INSTALL)
<%else%>
<%if(sharedname || staticname)%>
__postbuild__: $(VLIBS) $(INSTALL)
<%else%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
__postbuild__: $(GENERATED_DIRTY)
<%foreach(avoids requires)%>
endif
<%endfor%>
<%endif%>
<%endif%>

__postbuild__:
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
	@<%eval(postbuild)%>
<%foreach(avoids requires)%>
endif
<%endfor%>

<%endif%>

.PHONY: install
install: <%if(postbuild)%>__postbuild__<%else%>all<%endif%>
INSTALL_LIB ?= lib
ifneq ($(INSTALL_PREFIX),)
ifneq ($(install_rpath),0)
LD_RPATH ?= -Wl,-rpath,
LDFLAGS += $(LD_RPATH)$(INSTALL_PREFIX)/$(INSTALL_LIB) $(LD_RPATH_FLAGS)
endif
endif

<%if(install_this_target)%>
PRJINST_OPTIONS ?=
INST_DIR ?= <%if(install_dir)%>/<%install_dir%><%else%>/$(notdir $(PWD))<%endif%>
COMMA = ,
SPACE = $(should_be_unset) $(should_be_unset)
INSTALLER ?= $(MPC_ROOT)/prj_install.pl
CUSTOM_INST_TAGS = $(sort <%custom_install%> <%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%custom_type%> <%endif%><%endfor%><%endfor%>)

<%if(staticname || sharedname)%>
<%if(install_headers)%>
LIB_INST_TAGS = header_files template_files inline_files$(if $(CUSTOM_INST_TAGS), $(CUSTOM_INST_TAGS))
LIB_INST_LOCATIONS = $(foreach tag,$(LIB_INST_TAGS),-b $(tag)=include$(INST_DIR))

<%else%>
ifeq ($(shared_libs),1)
<%endif%>
INST_TAGS = lib_output$(if $(LIB_INST_TAGS), $(LIB_INST_TAGS))
INST_LOCATIONS = $(LIB_INST_LOCATIONS) -o lib_output=$(INSTALL_LIB)
<%if(!install_headers)%>
endif
<%endif%>

<%else%>
<%if(exename)%>
INST_TAGS = exe_output
INST_LOCATIONS = -o exe_output=bin

<%else%>
INST_TAGS = $(CUSTOM_INST_TAGS)<%if(custom_inst_tags)%> <%custom_inst_tags%><%endif%>
INST_LOCATIONS = $(foreach tag,$(INST_TAGS),-b $(tag)=include$(INST_DIR))

<%endif%>
<%endif%>
DATA_INST_TAGS = <%foreach(custom_types)%><%if(compares(custom_type, installdata_files))%><%if(custom_type->input_files)%>installdata_files<%endif%><%endif%><%endfor%>
INST_LOCATIONS += $(if $(DATA_INST_TAGS),-x installdata_files -b installdata_files=share$(INST_DIR))
INST_TAGS := $(INST_TAGS)$(if $(DATA_INST_TAGS), $(DATA_INST_TAGS))

ifeq ($(INSTALLER),/prj_install.pl)
INSTALLER = $(ACE_ROOT)/MPC/prj_install.pl
endif

ifeq ($(LIBCHECK),1)
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
install:
ifeq ($(INST_TAGS),)
	@echo Nothing to install.
else
ifeq ($(INSTALL_PREFIX),)
	@echo The variable INSTALL_PREFIX must be set to install.
	@echo If binaries are already built and you want to use RPATH,
	@echo they must be rebuilt after changing INSTALL_PREFIX.
	@false
else
	perl -ne'if (/^#END MPC-Generated Install Info/) {exit 0}' \
	  -e'elsif (/^#BEGIN MPC-Generated Install Info/) {$$ok=1}' \
	  -e'elsif ($$ok && s/^#//) {print}' $(MAKEFILE) | \
	$(INSTALLER) -i -s $(subst $(SPACE),$(COMMA),$(INST_TAGS)) \
	  $(INST_LOCATIONS) $(if $(ARCH),-d $(ARCH)) $(PRJINST_OPTIONS) \
	  $(DESTDIR)$(INSTALL_PREFIX)
<%foreach(custom_types)%>
<%if(compares(custom_type, pkgconfig_files))%>
<%if(custom_type->input_files)%>
	$(ACE_ROOT)/bin/ace_install_pkgconfig.pl <%custom_type->input_files%> --destdir "$(DESTDIR)" --prefix $(INSTALL_PREFIX) --libdir $(INSTALL_LIB) --libs "$(LIBS)" --version $(GNUACE_PROJECT_VERSION)<%foreach(pkgconfig_variables)%> --custom "<%pkgconfig_variable%>"<%endfor%>
<%endif%>
<%endif%>
<%endfor%>
<%marker(postinstall)%>
endif
endif
<%foreach(requires avoids)%>
endif
<%endfor%>
endif

#BEGIN MPC-Generated Install Info
<%genins%>
#END MPC-Generated Install Info
<%endif%>

<%marker(bottom)%>
