1#
2#   Instance/gswapp.make
3#
4#   Instance Makefile rules to build GNUstep web based applications.
5#
6#   Copyright (C) 1997-2004 Free Software Foundation, Inc.
7#
8#   Author:  Manuel Guesdon <mguesdon@sbuilders.com>,
9#            Nicola Pero <n.pero@mi.flashnet.it>
10#   Based on application.make by Ovidiu Predescu <ovidiu@net-community.com>
11#   Based on gswapp.make by Helge Hess, MDlink online service center GmbH.
12#   Based on the original version by Scott Christley.
13#
14#   This file is part of the GNUstep Makefile Package.
15#
16#   This library is free software; you can redistribute it and/or
17#   modify it under the terms of the GNU General Public License
18#   as published by the Free Software Foundation; either version 3
19#   of the License, or (at your option) any later version.
20#
21#   You should have received a copy of the GNU General Public
22#   License along with this library; see the file COPYING.
23#   If not, write to the Free Software Foundation,
24#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
26ifeq ($(NEEDS_GUI),)
27  NEEDS_GUI = no
28endif
29
30ifeq ($(RULES_MAKE_LOADED),)
31include $(GNUSTEP_MAKEFILES)/rules.make
32endif
33
34# FIXME/TODO - this file has not been updated to use
35# Instance/Shared/bundle.make because it is linking resources instead of
36# copying them.
37
38# TODO: We should remove this makefile since it's not really supported.
39
40
41# The name of the application is in the GSWAPP_NAME variable.
42# The list of languages the app is localized in are in xxx_LANGUAGES <==
43# The list of application resource file are in xxx_RESOURCE_FILES
44# The list of localized application resource file are in
45#  xxx_LOCALIZED_RESOURCE_FILES <==
46# The list of application resource directories are in xxx_RESOURCE_DIRS
47# The list of application web server resource directories are in
48#  xxx_WEBSERVER_RESOURCE_DIRS <==
49# The list of localized application web server resource directories are in
50#  xxx_LOCALIZED_WEBSERVER_RESOURCE_DIRS
51# where xxx is the application name <==
52
53# Determine the application directory extension
54GSWAPP_EXTENSION = gswa
55
56.PHONY: internal-gswapp-all_ \
57        internal-gswapp-install_ \
58        internal-gswapp-uninstall_ \
59        internal-gswapp-copy_into_dir
60
61#
62# Determine where to install.  By default, install into GNUSTEP_WEB_APPS.
63#
64ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),)
65  GSWAPP_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR)
66endif
67
68ifeq ($(GSWAPP_INSTALL_DIR),)
69  GSWAPP_INSTALL_DIR = $(GNUSTEP_WEB_APPS)
70endif
71
72# Libraries that go before the WO libraries
73ALL_GSW_LIBS =								\
74	$(ADDITIONAL_GSW_LIBS) $(AUXILIARY_GSW_LIBS) $(GSW_LIBS)	\
75        $(ALL_LIBS)
76
77GSWAPP_DIR_NAME = $(GNUSTEP_INSTANCE:=.$(GSWAPP_EXTENSION))
78GSWAPP_DIR = $(GNUSTEP_BUILD_DIR)/$(GSWAPP_DIR_NAME)
79
80#
81# Now include the standard resource-bundle routines from Shared/bundle.make
82#
83
84ifneq ($(FOUNDATION_LIB), apple)
85  # GNUstep bundle
86  GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(GSWAPP_DIR)/Resources
87  GSWAPP_INFO_PLIST_FILE = $(GSWAPP_DIR)/Resources/Info-gnustep.plist
88else
89  # OSX bundle
90  GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(GSWAPP_DIR)/Contents/Resources
91  GSWAPP_INFO_PLIST_FILE = $(GSWAPP_DIR)/Contents/Info.plist
92endif
93GNUSTEP_SHARED_BUNDLE_INSTALL_NAME = $(GSWAPP_DIR_NAME)
94GNUSTEP_SHARED_BUNDLE_INSTALL_LOCAL_PATH = .
95GNUSTEP_SHARED_BUNDLE_INSTALL_PATH = $(GSWAPP_INSTALL_DIR)
96include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
97
98ifneq ($(FOUNDATION_LIB), apple)
99GSWAPP_FILE_NAME = $(GSWAPP_DIR_NAME)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
100else
101GSWAPP_FILE_NAME = $(GSWAPP_DIR_NAME)/Contents/MacOS/$(GNUSTEP_INSTANCE)$(EXEEXT)
102endif
103
104GSWAPP_FILE = $(GNUSTEP_BUILD_DIR)/$(GSWAPP_FILE_NAME)
105
106#
107# Internal targets
108#
109
110$(GSWAPP_FILE): $(OBJ_FILES_TO_LINK)
111ifeq ($(OBJ_FILES_TO_LINK),)
112	$(WARNING_EMPTY_LINKING)
113endif
114	$(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) $(CC_LDFLAGS) -o $(LDOUT)$@ \
115	$(OBJ_FILES_TO_LINK) $(ALL_LIB_DIRS) $(ALL_GSW_LIBS)$(END_ECHO)
116
117#
118# Compilation targets
119#
120ifeq ($(FOUNDATION_LIB), apple)
121internal-gswapp-all_:: \
122	$(GNUSTEP_OBJ_INSTANCE_DIR) \
123        $(OBJ_DIRS_TO_CREATE) \
124        $(GSWAPP_DIR)/Contents/MacOS \
125        $(GSWAPP_FILE) \
126        shared-instance-bundle-all \
127        $(GSWAPP_INFO_PLIST_FILE)
128
129$(GSWAPP_DIR)/Contents/MacOS:
130	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
131else
132
133internal-gswapp-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
134                    $(OBJ_DIRS_TO_CREATE) \
135                    $(GSWAPP_DIR)/$(GNUSTEP_TARGET_LDIR) \
136                    $(GSWAPP_FILE) \
137                    $(GSWAPP_DIR)/Resources \
138                    $(GSWAPP_INFO_PLIST_FILE) \
139                    shared-instance-bundle-all
140
141$(GSWAPP_DIR)/$(GNUSTEP_TARGET_LDIR):
142	$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
143
144endif
145
146PRINCIPAL_CLASS = $(strip $($(GNUSTEP_INSTANCE)_PRINCIPAL_CLASS))
147
148ifeq ($(PRINCIPAL_CLASS),)
149  PRINCIPAL_CLASS = $(GNUSTEP_INSTANCE)
150endif
151
152HAS_GSWCOMPONENTS = $($(GNUSTEP_INSTANCE)_HAS_GSWCOMPONENTS)
153GSWAPP_INFO_PLIST = $($(GNUSTEP_INSTANCE)_GSWAPP_INFO_PLIST)
154MAIN_MODEL_FILE = $(strip $(subst .gmodel,,$(subst .gorm,,$(subst .nib,,$($(GNUSTEP_INSTANCE)_MAIN_MODEL_FILE)))))
155
156
157$(GSWAPP_INFO_PLIST_FILE): $(GNUSTEP_PLIST_DEPEND)
158	$(ECHO_CREATING)(echo "{"; echo '  NOTE = "Automatically generated, do not edit!";'; \
159	  echo "  NSExecutable = \"$(GNUSTEP_INSTANCE)\";"; \
160	  echo "  NSPrincipalClass = \"$(PRINCIPAL_CLASS)\";"; \
161	  if [ "$(HAS_GSWCOMPONENTS)" != "" ]; then \
162	    echo "  HasGSWComponents = \"$(HAS_GSWCOMPONENTS)\";"; \
163	  fi; \
164	  echo "  NSMainNibFile = \"$(MAIN_MODEL_FILE)\";"; \
165	  if [ -r "$(GNUSTEP_PLIST_DEPEND)" ]; then \
166	    cat $(GNUSTEP_PLIST_DEPEND); \
167	  fi; \
168	  if [ "$(GSWAPP_INFO_PLIST)" != "" ]; then \
169	    cat $(GSWAPP_INFO_PLIST); \
170	  fi; \
171	  echo "}") >$@$(END_ECHO)
172
173internal-gswapp-copy_into_dir:: shared-instance-bundle-copy_into_dir
174
175# install/uninstall targets
176
177$(GSWAPP_INSTALL_DIR):
178	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
179
180internal-gswapp-install_:: shared-instance-bundle-install
181ifeq ($(strip),yes)
182	$(ECHO_STRIPPING)$(STRIP) $(GSWAPP_INSTALL_DIR)/$(GSWAPP_FILE_NAME)$(END_ECHO)
183endif
184
185internal-gswapp-uninstall_:: shared-instance-bundle-uninstall
186
187include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make
188