1#   -*-makefile-*-
2#   Master/subproject.make
3#
4#   Master Makefile rules to build subprojects in GNUstep projects.
5#
6#   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
7#
8#   Author:  Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
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
23ifeq ($(RULES_MAKE_LOADED),)
24include $(GNUSTEP_MAKEFILES)/rules.make
25endif
26
27#
28# The name of the subproject is in the SUBPROJECT_NAME variable.
29#
30
31SUBPROJECT_NAME := $(strip $(SUBPROJECT_NAME))
32
33# Count the number of subprojects - we can support only one!
34ifneq ($(words $(SUBPROJECT_NAME)), 1)
35
36SUBPROJECT_NAME := $(word 1, $(SUBPROJECT_NAME))
37$(warning Only a single subproject can be built in any directory!)
38$(warning Ignoring all subprojects and building only $(SUBPROJECT_NAME))
39
40endif
41
42build-headers:: $(SUBPROJECT_NAME:=.build-headers.subproject.variables)
43
44# No need for parallel building, since we are guaranteed to always
45# have only one subproject.  Avoid the parallel building submake for
46# efficiency in that case.
47internal-all:: $(GNUSTEP_OBJ_DIR) $(SUBPROJECT_NAME:=.all.subproject.variables)
48
49internal-install:: $(SUBPROJECT_NAME:=.install.subproject.variables)
50
51internal-uninstall:: $(SUBPROJECT_NAME:=.uninstall.subproject.variables)
52
53_PSWRAP_C_FILES = $($(SUBPROJECT_NAME)_PSWRAP_FILES:.psw=.c)
54_PSWRAP_H_FILES = $($(SUBPROJECT_NAME)_PSWRAP_FILES:.psw=.h)
55
56internal-clean::
57ifneq ($(_PSWRAP_C_FILES)$(_PSWRAP_H_FILES)$($(SUBPROJECT_NAME)_HAS_RESOURCE_BUNDLE),)
58	(cd $(GNUSTEP_BUILD_DIR); \
59	rm -rf $(_PSWRAP_C_FILES) $(_PSWRAP_H_FILES) Resources)
60endif
61
62internal-distclean::
63
64SUBPROJECTS_WITH_SUBPROJECTS = $(strip $(patsubst %,$(SUBPROJECT_NAME),$($(SUBPROJECT_NAME)_SUBPROJECTS)))
65ifneq ($(SUBPROJECTS_WITH_SUBPROJECTS),)
66internal-clean:: $(SUBPROJECTS_WITH_SUBPROJECTS:=.clean.subproject.subprojects)
67internal-distclean:: $(SUBPROJECTS_WITH_SUBPROJECTS:=.distclean.subproject.subprojects)
68endif
69
70internal-strings:: $(SUBPROJECT_NAME:=.strings.subproject.variables)
71
72$(SUBPROJECT_NAME): $(GNUSTEP_OBJ_DIR)
73	$(ECHO_NOTHING_RECURSIVE_MAKE)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory $@.all.subproject.variables$(END_ECHO_RECURSIVE_MAKE)
74
75