2 #----------------------------------------------------------------------------
8 #----------------------------------------------------------------------------
15 CLEANUP_OBJDIRS = $(VDIR)
18 CLEANUP_OBJDIRS = $(VDIR)
23 CLEANUP_OBJDIRS += $(VSHDIR)
24 endif # CLEANUP_VSHLIB
27 CLEANUP_DIRS += $(TEMPINCDIR)
33 ifeq ($(use_pwd_call),)
41 .PHONY: makefile_name.local
42 ifneq ($(use_pwd_call),1)
45 @echo GNUmakefile: $(shell pwd)/$(MAKEFILE) MAKEFLAGS=$(MAKEFLAGS)
48 ECHO_BLANK_LINE ?= echo
51 @echo GNUmakefile: $(call PWD)/$(MAKEFILE) MAKEFLAGS=$(MAKEFLAGS)
55 all.local: makefile_name.local build.objdirs build.local binout.local
57 #----------------------------------------------------------------------------
58 # C/C++ compilation targets
59 #----------------------------------------------------------------------------
66 VBIN ?= $(ARCH_BIN:%=%$(VAR))
71 # Always build the V* targets in this order. We control assignment to them
72 # elsewhere. We add the existing $(BUILD) targets to the end to allow the
73 # caller to set additional ones, e.g., when defining multiple targets in a
74 # single makefile--note that we filter out any that are already present.
75 VBUILD = $(IDL_SRC) $(VLIBS) $(VBIN) $(filter-out $(IDL_SRC) $(VLIBS) $(VBIN), $(BUILD))
77 build.local: $(VBUILD)
79 # By setting SUFFIXES to nothing, we turn off all implicit rules, and force
80 # make to only use the explicit ones we define.
87 ifeq ($(static_link),1)
88 LDFLAGS += $(STATIC_LINK_FLAG)
89 endif # static_link = 1
93 # Define a canned command set to create the output object directory if needed.
94 ifeq ($(vxworks_ntbuild),1)
96 @if not exist $(subst /,\,$(@D)) $(MKDIR) $(subst /,\,$(@D)) $(ACE_NUL_STDERR)
100 @-test -d $(@D) || $(MKDIR) $(@D) $(ACE_NUL_STDERR)
105 CC_OUTPUT_FLAG_SEP ?= $(nullstring) #space
107 %.$(PREPROCESS_SUFFIX): %.c
108 $(PREPROCESS.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
110 %.$(PREPROCESS_SUFFIX): %.cpp
111 $(PREPROCESS.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
113 $(VDIR)%.$(OBJEXT): %.c
115 $(COMPILE.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
118 $(VDIR)%.$(OBJEXT): %.C
120 $(COMPILE.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
123 $(VDIR)%.$(OBJEXT): %.cpp
125 $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
128 $(VDIR)%.$(OBJEXT): %.cc
130 $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
133 $(VDIR)%.$(OBJEXT): %.cxx
135 $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
139 ifneq (,$(COMPILE.rc))
142 $(COMPILE.rc) $(RC_OUTPUT_FLAG) $@ $(abspath $<)
146 # If SOLINK is defined, then the .$(SOEXT) file is built from the
147 # .$(OBJEXT) file via separate rules in the same directory.
148 # Otherwise, the .$(SOEXT) and .$(OBJEXT) are built via the same rule.
149 # SOLINK is required for the repository under gcc.
151 $(VSHDIR)%.$(OBJEXT): %.c
153 $(COMPILE.c) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
155 $(VSHDIR)%.$(OBJEXT): %.C
157 $(COMPILE.c) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
159 # I added the "Executable Shared Object (ESO)" define to separate between
160 # normal shared object files and executable shared object files (the kind
161 # that the service configurator needs to be able to function).
162 # 970104 Marius Kjeldahl <mariusk@sn.no, marius@funcom.com>
164 $(VSHDIR)%.$(SOEXT): %.cpp
168 $(VSHDIR)%.$(SOEXT): %.cpp
173 $(VSHDIR)%.$(OBJEXT): %.cc
175 $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
177 $(VSHDIR)%.$(OBJEXT): %.cpp
179 $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
181 $(VSHDIR)%.$(OBJEXT): %.cxx
183 $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<)
185 ifneq (,$(COMPILE.rc))
186 $(VSHDIR)%.rc.$(OBJEXT): %.rc
188 $(COMPILE.rc) $(RC_OUTPUT_FLAG) $@ $(abspath $<)
191 $(VSHDIR)%.$(SOEXT): $(VSHDIR)%.$(OBJEXT)
196 #----------------------------------------------------------------------------
197 # Library generation targets
198 #----------------------------------------------------------------------------
200 #### show_statics shows static objects in locally-created object files.
201 #### It assumes that the object files were built using g++.
202 #### TOOLENV selects the proper nm in VxWorks host environments.
203 #### TOOLDIR allows specification of the full path to nm via definition
204 #### in the platform_macros.GNU file.
206 -@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | \
207 grep -E ' global destructors '; true
209 #### show_uninit shows uninitialized data in locally-created object files.
210 #### TOOLENV selects the proper nm in VxWorks host environments.
212 -@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | grep -E ' b '
214 #----------------------------------------------------------------------------
215 # Installation targets
216 #----------------------------------------------------------------------------
218 # Always add LIB_INSTALL to INSTALL, so libs will get installed even no BIN
219 # is built. LIB_INSTALL is a dependency for BIN, so libs are installed prior
220 # to use. Also, make LIB_INSTALL depend on VLIBS, so libs get built prior to
223 INSTALL ?= $(LIB_INSTALL)
224 $(LIB_INSTALL): $(VLIBS)
228 $(INSBIN)/$(VBIN): $(VBIN)
232 binout.local: $(INSTALL)
235 ifdef CLEANUP_INSTALL
236 ifneq ($(strip $(CLEANUP_INSTALL)),)
237 $(RM) $(CLEANUP_INSTALL)
238 endif # CLEANUP_INSTALL
239 endif # CLEANUP_INSTALL
244 #### ACE+TAO use COMSPEC, but ComSpec is defined.
250 #### Assume we're on a WIN32 host.
253 ifeq ($(symlinks),absolute)
256 LN_S = $(ACE_ROOT)/bin/add_rel_link.sh
261 # Don't call shell/call directly in the rule below, since we may need to
262 # add the architecture specific suffix to the directory. Using $(shell pwd)
263 # instead of just $(PWD) is needed for Korn shell on Solaris.
264 ifneq ($(use_pwd_call),1)
265 ARCH_SOURCE_DIR := $(patsubst %/,%,$(shell pwd)/$(ARCH))
267 ARCH_SOURCE_DIR := $(patsubst %/,%,$(call PWD)/$(ARCH))
270 $(INSBIN)/%$(VAR)$(EXEEXT) \
284 ifeq ($(vxworks_ntbuild),1)
286 @if not "$(ARCH_SOURCE_DIR)/$(@F)" == "$@" \
287 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ && \
288 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@
290 @if not exist $@ $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)) && \
291 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)) && \
293 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ && \
294 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@
296 else #not vxworks_ntbuild
297 ifeq ($(firstword $(LN_S)),cp)
298 ifneq ($(SOVERSION),)
299 @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \
300 $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
301 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
302 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
305 @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \
307 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \
308 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \
310 else #firstword of LN_S is not cp, so we're using real symlinks
311 ifneq ($(SOVERSION),)
312 ifneq ($(versioned_so),2)
313 @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \
314 if test ! -s $@ ; then \
315 $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
316 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
317 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \
321 @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \
322 if test ! -s $@ ; then \
323 $(RM) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \
324 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \
325 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \
330 @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \
331 if test ! -s $@ ; then \
333 echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \
334 $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \
338 endif #vxworks_ntbuild
341 #special for MVS in order to use the .x files
342 @if test -w $(@D) ; then \
343 if test ! -s $(@:.$(SOEXT)=.x) ; then \
344 $(RM) $(@); $(LN_S) $(ARCH_SOURCE_DIR)/$(@F:.$(SOEXT)=.x) $(@:.$(SOEXT)=.x) ; \
349 #----------------------------------------------------------------------------
351 #----------------------------------------------------------------------------
353 clean_binaries.local:
354 ifneq ($(BIN_UNCHECKED),)
355 -$(RM) $(BIN_UNCHECKED)
357 ifneq ($(SHLIB_UNCHECKED),)
358 -$(RM) $(SHLIB_UNCHECKED)
359 ifeq ($(versioned_so),1)
360 -$(RM) $(SHLIB_UNCHECKED)$(SOVERSION)
362 ifeq ($(versioned_so),2)
363 -$(RM) $(SHLIB_UNCHECKED:.$(SOEXT)=$(SOVERSION).$(SOEXT))
368 clean_idl_stubs.local: makefile_name.local
370 -$(RM) $(foreach ext, $(IDL_EXT), $(addsuffix $(ext), $(IDL_FILES)))
374 ifneq ($(CLEANUP_BIN),)
376 REALCLEAN_FILES += $(CLEANUP_BIN:%=%$(EXEEXT)) $(CLEANUP_BIN:%=%_debug$(EXEEXT)) $(CLEANUP_BIN:%=%_profile$(EXEEXT)) $(CLEANUP_BIN:%=%_optimize$(EXEEXT))
381 ifneq ($(CLEANUP_LIB),)
383 REALCLEAN_FILES += $(CLEANUP_LIB:%=%) $(CLEANUP_LIB:%=%_debug) $(CLEANUP_LIB:%=%_profile) $(CLEANUP_LIB:%=%_optimize)
389 ifneq ($(CLEANUP_SHLIB),)
391 REALCLEAN_FILES += $(CLEANUP_VSHLIB:%=%) $(CLEANUP_VSHLIB_NO_VER:%=%*) $(CLEANUP_VSHLIB_NO_VER:%=%_debug) $(CLEANUP_VSHLIB_NO_VER:%=%_profile) $(CLEANUP_VSHLIB_NO_VER:%=%_optimize)
392 endif # !CLEANUP_SHLIB
396 CLEANUP_OBJS += $(addprefix $(VDIR), $(OBJS))
398 ifneq ($(CLEANUP_BIN),)
399 CLEANUP_OBJS += $(addsuffix .$(OBJEXT),$(addprefix $(VDIR),$(basename $(CLEANUP_BIN:$(ARCH)/%=%)))) $(VOBJS)
402 CLEANUP_OBJS += $(VSHOBJS)
405 clean.local: makefile_name.local
408 *.$(OBJEXT) *~ *.bak *.rpo *.sym lib*.*_pure_* \
409 GNUmakefile.old core-r $(CLEANUP_DIRS) \
410 cxx_repository ptrepository ti_files \
411 gcctemp.c gcctemp so_locations *.ics \
412 templateregistry templateregistry.* ir.out core.* *.core $(CLEANUP_OBJS)
415 realclean.local: clean.local clean_binout.local clean_idl_stubs.local
417 -$(RM) -r $(REALCLEAN_FILES) $(sort $(CLEANUP_OBJDIRS)) $(ARCH)
421 #----------------------------------------------------------------------------
422 # Dependency generation target
423 #----------------------------------------------------------------------------
425 TOP_MAKEFILE := $(word 1,$(MAKEFILE_LIST))
426 MAKEFILE ?= $(TOP_MAKEFILE)
427 DEPENDENCY_FILE ?= $(MAKEFILE)
428 IDL_DEPENDENCY_FILES ?= $(MAKEFILE)
430 TAO_ROOT ?= $(ACE_ROOT)/TAO
432 # If no libraries are build in the current directory (actually, if
433 # rules.lib.GNU isn't included), then SOEXT might not be set.
436 ORIGdepend.local: $(MAKEFILE)
437 @$(RM) $(MAKEFILE).old
438 @cp $(MAKEFILE) $(MAKEFILE).old
439 $(ACE_ROOT)/bin/g++dep -f $(MAKEFILE) $(CPPFLAGS) -DMAKEDEPEND $(LSRC) $(SRC) $(PSRC)
441 sed -e "s;$(TAO_ROOT);\$$(TAO_ROOT);g" \
442 -e "s;$(ACE_ROOT);\$$(ACE_ROOT);g" \
443 $(ACE_DEPEND_SED_CMD) \
444 -e '/$$(ACE_ROOT)\/ace\/config[^\.]*\.h/d' \
445 -e "s; /[-a-zA-Z0-9_./]*\.h;;g" \
446 -e "s;\([-a-zA-Z0-9._]*\)\.$(OBJEXT):;.obj/\1.$(OBJEXT) .obj/\1.$(SOEXT) $(VSHDIR)\1.$(OBJEXT) $(VSHDIR)\1.$(SOEXT):;" \
448 @cat $(MAKEFILE).new >$(MAKEFILE)
449 @$(RM) $(MAKEFILE).new
450 @if cmp -s $(MAKEFILE) $(MAKEFILE).old ;\
451 then echo "GNUmakefile dependencies unchanged." ;\
453 echo "GNUmakefile dependencies updated." ;\
455 $(RM) $(MAKEFILE).old ;
457 ifneq ($(MAKEFILE),$(DEPENDENCY_FILE))
459 ifeq ($(lacks_touch),1)
460 copy NUL "$(DEPENDENCY_FILE)"
462 touch $(DEPENDENCY_FILE)
464 depend_idl.local depend.local: $(DEPENDENCY_FILE)
465 -include $(DEPENDENCY_FILE)
468 ifneq ($(MAKEFILE),$(IDL_DEPENDENCY_FILES))
469 $(IDL_DEPENDENCY_FILES):
470 ifeq ($(lacks_touch),1)
475 depend_idl.local: $(IDL_DEPENDENCY_FILES)
476 -include $(IDL_DEPENDENCY_FILES)
481 DEPGEN ?= perl $(ACE_ROOT)/bin/depgen.pl
483 DEPGEN ?= $(ACE_ROOT)/bin/depgen.pl
484 DEPGEN_ENV := ACE_PLATFORM_CONFIG=$(ACE_PLATFORM_CONFIG) \
485 ACE_DEPEND_SED_CMD="$(ACE_DEPEND_SED_CMD)"
488 # Use findstring just in case the script was preceded by /usr/bin/perl
489 ifeq ($(findstring depgen.pl, $(notdir $(DEPGEN))), depgen.pl)
490 DEPEND_CMD_ARGS += -i
492 DEPEND_CMD_ARGS += -n
496 depend_idl.local: $(MAKEFILE) idl_stubs.local incremental_depend_idl
498 depend.local: $(MAKEFILE) idl_stubs.local
499 @$(RM) $(DEPENDENCY_FILE).old
500 @cp $(DEPENDENCY_FILE) $(DEPENDENCY_FILE).old
501 $(DEPGEN_ENV) $(DEPGEN) -A $(DEPEND_CMD_ARGS) -f $(DEPENDENCY_FILE) \
502 $(CPPFLAGS) -t gnu -DMAKEDEPEND $(CCFLAGS) $(LSRC) $(SRC) $(PSRC)
503 @if cmp -s $(DEPENDENCY_FILE) $(DEPENDENCY_FILE).old ;\
504 then echo "GNUmakefile dependencies unchanged." ;\
506 echo "GNUmakefile dependencies updated." ;\
508 $(RM) $(DEPENDENCY_FILE).old ;
510 #----------------------------------------------------------------------------
512 #----------------------------------------------------------------------------
515 IDL_CLIENT_HDR_EXT ?=
517 idl_stubs.local: $(foreach file, $(IDL_FILES), $(file)$(IDL_CLIENT_HDR_EXT))
519 #----------------------------------------------------------------------------
520 # no-op idl dependency :: Makefiles append to this rule if there
521 # are idl dependencies.
522 #----------------------------------------------------------------------------
524 incremental_depend_idl:: ;
526 #----------------------------------------------------------------------------
527 # Variant targets and conditional macros
528 #----------------------------------------------------------------------------
530 build.objdirs: $(CLEANUP_DIRS)
532 ifeq ($(MKDIR_NTSTYLE),1)
534 @if not exist $@ $(MKDIR) $@ $(ACE_NUL_STDERR)
537 @test -d $@ || $(MKDIR) $@ $(ACE_NUL_STDERR)
541 if [ "n$(ARCH_BIN)" != "n" ]; then \
542 (svn propget svn:ignore .; echo $(ARCH_BIN)) | sort | uniq | sed '/^$$/d' >SvNiGnOrE; \
543 svn propset svn:ignore -F SvNiGnOrE .; \
547 #----------------------------------------------------------------------------
548 # Optional private, site-specific rules
549 #----------------------------------------------------------------------------
551 private_rules_file ?= rules.private.GNU
552 -include $(private_rules_file)