1#   -*-makefile-*-
2#   Instance/objc.make
3#
4#   Instance Makefile rules to build ObjC-based (but not GNUstep) programs.
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 ObjC program(s) is in the OBJC_PROGRAM_NAME variable.
25#
26# xxx We need to prefix the target name when cross-compiling
27#
28
29ifeq ($(RULES_MAKE_LOADED),)
30include $(GNUSTEP_MAKEFILES)/rules.make
31endif
32
33.PHONY: internal-objc_program-all_ \
34        internal-objc_program-install_ \
35        internal-objc_program-uninstall_ \
36	internal-objc_program-compile
37
38# This is the directory where the objc programs get installed. If you
39# don't specify a directory they will get installed in the Tools
40# directory in GNUSTEP_LOCAL_ROOT.
41ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
42  OBJC_PROGRAM_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
43endif
44
45ifeq ($(OBJC_PROGRAM_INSTALL_DIR),)
46OBJC_PROGRAM_INSTALL_DIR = $(GNUSTEP_TOOLS)
47endif
48
49ALL_OBJC_LIBS =								\
50	$(ADDITIONAL_OBJC_LIBS) $(AUXILIARY_OBJC_LIBS) $(OBJC_LIBS)	\
51        $(TARGET_SYSTEM_LIBS)
52
53ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
54# Standard building
55internal-objc_program-all_:: \
56                  $(GNUSTEP_OBJ_INSTANCE_DIR) \
57                  $(OBJ_DIRS_TO_CREATE) \
58                  $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
59else
60# Parallel building.  The actual compilation is delegated to a
61# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
62# That sub-make invocation will compile files in parallel.
63internal-objc_program-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
64	$(ECHO_NOTHING_RECURSIVE_MAKE)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
65	internal-objc_program-compile \
66	GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
67	GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \
68	GNUSTEP_OPERATION=compile \
69	GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \
70	_GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO_RECURSIVE_MAKE)
71
72internal-objc_program-compile: $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
73endif
74
75$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK)
76ifeq ($(OBJ_FILES_TO_LINK),)
77	$(WARNING_EMPTY_LINKING)
78endif
79	$(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) $(CC_LDFLAGS) -o $(LDOUT)$@ \
80	$(OBJ_FILES_TO_LINK) $(ALL_LIB_DIRS) $(ALL_OBJC_LIBS)$(END_ECHO)
81
82internal-objc_program-install_:: $(OBJC_PROGRAM_INSTALL_DIR)/$(GNUSTEP_TARGET_LDIR)
83	$(ECHO_INSTALLING)$(INSTALL_PROGRAM) -m 0755 \
84	    $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT) \
85	    $(OBJC_PROGRAM_INSTALL_DIR)/$(GNUSTEP_TARGET_LDIR)$(END_ECHO)
86
87$(OBJC_PROGRAM_INSTALL_DIR)/$(GNUSTEP_TARGET_LDIR):
88	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
89
90internal-objc_program-uninstall_::
91	$(ECHO_UNINSTALLING)rm -f $(OBJC_PROGRAM_INSTALL_DIR)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)$(END_ECHO)
92
93include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make
94