1#   -*-makefile-*-
2#   Instance/ctool.make
3#
4#   Instance Makefile rules to build GNUstep-based command line ctools.
5#
6#   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
7#
8#   Author:  Scott Christley <scottc@net-community.com>
9#   Author:  Nicola Pero <nicola@brainstorm.co.uk>
10#
11#   This file is part of the GNUstep Makefile Package.
12#
13#   This library is free software; you can redistribute it and/or
14#   modify it under the terms of the GNU General Public License
15#   as published by the Free Software Foundation; either version 3
16#   of the License, or (at your option) any later version.
17#
18#   You should have received a copy of the GNU General Public
19#   License along with this library; see the file COPYING.
20#   If not, write to the Free Software Foundation,
21#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23#
24# The name of the ctools is in the CTOOL_NAME variable.
25#
26# xxx We need to prefix the target name when cross-compiling
27#
28# This is the same as a tool, but it is not linked against libobjc and
29# it is not linked against the foundation library.  This is good if
30# you are not using any Objective-C stuff in here.
31#
32# PS: this means you must leave the variable xxx_OBJC_FILES (and
33# xxx_OBJCC_FILES) empty (if you don't, it won't work).  If you need
34# to compile Objective-C stuff, please use tool.make.
35
36ifeq ($(RULES_MAKE_LOADED),)
37include $(GNUSTEP_MAKEFILES)/rules.make
38endif
39
40# This is the directory where the ctools get installed. If you don't
41# specify a directory they will get installed in the GNUstep Local
42# root.
43ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
44  CTOOL_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
45endif
46
47ifeq ($(CTOOL_INSTALL_DIR),)
48  CTOOL_INSTALL_DIR = $(GNUSTEP_TOOLS)
49endif
50
51.PHONY: internal-ctool-all_ \
52        internal-ctool-install_ \
53        internal-ctool-uninstall_ \
54	internal-ctool-compile
55
56# Override the default with just the minimal C libs required to link
57ALL_LIBS =							\
58     $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS)		\
59     $(TARGET_SYSTEM_LIBS)
60
61#
62# Compilation targets
63#
64ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
65# Standard building
66internal-ctool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
67                      $(OBJ_DIRS_TO_CREATE) \
68                     $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
69else
70# Parallel building.  The actual compilation is delegated to a
71# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
72# That sub-make invocation will compile files in parallel.
73internal-ctool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
74	$(ECHO_NOTHING_RECURSIVE_MAKE)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
75	internal-ctool-compile \
76	GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
77	GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \
78	GNUSTEP_OPERATION=compile \
79	GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \
80	_GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO_RECURSIVE_MAKE)
81
82internal-ctool-compile: $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
83endif
84
85$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK)
86ifeq ($(OBJ_FILES_TO_LINK),)
87	$(WARNING_EMPTY_LINKING)
88endif
89	$(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) -o $(LDOUT)$@ \
90	      $(OBJ_FILES_TO_LINK) \
91	      $(ALL_LIB_DIRS) $(ALL_LIBS)$(END_ECHO)
92
93internal-ctool-install_:: $(CTOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR)
94	$(ECHO_INSTALLING)$(INSTALL_PROGRAM) -m 0755 \
95	                   $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT) \
96	                   $(CTOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR)$(END_ECHO)
97
98$(CTOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR):
99	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
100
101internal-ctool-uninstall_::
102	$(ECHO_UNINSTALLING)rm -f $(CTOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)$(END_ECHO)
103
104include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make
105
106