File: java.make

package info (click to toggle)
gnustep-make 2.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,084 kB
  • sloc: sh: 3,990; objc: 806; makefile: 229; perl: 71
file content (188 lines) | stat: -rw-r--r-- 7,067 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#   -*-makefile-*-
#   Shared/java.make
#
#   Makefile fragment with rules to compile and install java files,
#   with associated property files.
#
#   Copyright (C) 2000, 2002, 2009 Free Software Foundation, Inc.
#
#   Author:  Nicola Pero <nicola.pero@meta-innovation.com>
#
#   This file is part of the GNUstep Makefile Package.
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 3
#   of the License, or (at your option) any later version.
#   
#   You should have received a copy of the GNU General Public
#   License along with this library; see the file COPYING.
#   If not, write to the Free Software Foundation,
#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#
# input variables:
#
#  $(GNUSTEP_INSTANCE)_JAVA_FILES: The list of Java files to compile.
#  These are the files that will be batch-compiled unless
#  xxx_BATCH_COMPILE_JAVA_FILES is set to no, or unless they can't be
#  batch-compiled because each of them uses a different flag.
#
#  JAVA_OBJ_FILES, JAVA_JNI_OBJ_FILES, SUBPROJECT_OBJ_FILES: the list
#  of object files (built by Instance/rules.make).  These are the
#  files that will always be built.  If some of the JAVA_OBJ_FILES are
#  not built from xxx_JAVA_FILES but from something else, they'll
#  still be compiled, but one by one - not batched with the
#  xxx_JAVA_FILES.
#
#  $(GNUSTEP_INSTANCE)_JAVA_PROPERTIES_FILES : the list of .properties files
#  to install together with the .java files
#
#  BATCH_COMPILE_JAVA_FILES: if this variable is set to 'no', batch compilation
#  of all Java files is disabled.
# 
#  $(GNUSTEP_INSTANCE)_BATCH_COMPILE_JAVA_FILES: if this variable is set to 'no',
#  batch compilation of xxx_JAVA_FILES is disabled and they are compiled one by one.
#  Else, it's enabled by default.

#
#  GNUSTEP_SHARED_JAVA_INSTALLATION_DIR : the base directory where to
#  install the files.
#

#
# public targets:
# 
#  shared-instance-java-all 
#  shared-instance-java-install
#  shared-instance-java-uninstall
#  shared-instance-java-clean
#

.PHONY: \
shared-instance-java-all \
shared-instance-java-install \
shared-instance-java-install-dirs \
shared-instance-java-uninstall \
shared-instance-java-clean

shared-instance-java-all: $(JAVA_OBJ_FILES) \
                         $(JAVA_JNI_OBJ_FILES) \
                         $(SUBPROJECT_OBJ_FILES)

# By default, we enable "batch compilation" of Java files.  This means
# that whenever make determines that a Java files needs recompilation,
# the command that recompiles that files will actually recompile all
# the files in the batch as well - causing make to then skip all
# subsequent rebuilding - which is much more efficient.
#
# You can turn this off by setting
#
#   xxx_BATCH_COMPILE_JAVA_FILES = no
#
# and this will cause all files to be always compiled one by one.
ifeq ($(BATCH_COMPILE_JAVA_FILES),)
  BATCH_COMPILE_JAVA_FILES = $($(GNUSTEP_INSTANCE)_BATCH_COMPILE_JAVA_FILES)
endif

# First set it to an empty string, which disables batch compilation.
JAVA_FILES_TO_BATCH_COMPILE = 

ifneq ($(BATCH_COMPILE_JAVA_FILES), no)
  # We can only batch compile the files if they all have the same flags.
  # So, if any file has a non-empty xxx_FILE_FILTER_OUT_FLAGS or 
  # xxx_FILE_FLAGS set, we disable batch compilation.
  #
  # PS: Here it would be nicer if we could not disable it completely,
  # but only batch compile the files that require no special flags.

  ifeq ($(strip $(foreach f,$($(GNUSTEP_INSTANCE)_JAVA_FILES),$($(f)_FILE_FILTER_OUT_FLAGS))$(foreach f,$($(GNUSTEP_INSTANCE)_JAVA_FILES),$($(f)_FILE_FLAGS))),)
    # OK - batch compilation is enabled, and all files have the same compilation flags, so turn it on :-)
    # By default, batch compile all xxx_JAVA_FILES.
    JAVA_FILES_TO_BATCH_COMPILE = $($(GNUSTEP_INSTANCE)_JAVA_FILES)
  endif
endif

# Say that you have a Pisa.java source file.  Here we install both
# Pisa.class (the main class) and also, if they exist, all class files
# with names beginning wih Pisa$ (such as Pisa$1$Nicola.class); these
# files are generated for nested/inner classes, and must be installed
# as well.  The fact we need to install these files is the reason why
# the following is more complicated than you would think at first
# glance.

# Build efficiently the list of possible inner/nested classes 

# We first build a list like in `Pisa[$]*.class Roma[$]*.class' by
# taking the JAVA_OBJ_FILES and replacing .class with [$]*.class, then
# we use wildcard to get the list of all files matching the pattern
UNESCAPED_ADD_JAVA_OBJ_FILES = $(wildcard $(JAVA_OBJ_FILES:.class=[$$]*.class))

# Finally we need to escape the $s before passing the filenames to the
# shell
ADDITIONAL_JAVA_OBJ_FILES = $(subst $$,\$$,$(UNESCAPED_ADD_JAVA_OBJ_FILES))

JAVA_PROPERTIES_FILES = $($(GNUSTEP_INSTANCE)_JAVA_PROPERTIES_FILES)

shared-instance-java-install: shared-instance-java-install-dirs
ifneq ($(JAVA_OBJ_FILES),)
	$(ECHO_INSTALLING_CLASS_FILES)for file in $(JAVA_OBJ_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    $(INSTALL_DATA) $$file \
	                    $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif
ifneq ($(ADDITIONAL_JAVA_OBJ_FILES),)
	$(ECHO_INSTALLING_ADD_CLASS_FILES)for file in $(ADDITIONAL_JAVA_OBJ_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    $(INSTALL_DATA) $$file \
	                    $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif
ifneq ($(JAVA_PROPERTIES_FILES),)
	$(ECHO_INSTALLING_PROPERTIES_FILES)for file in $(JAVA_PROPERTIES_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    $(INSTALL_DATA) $$file \
	                    $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif

shared-instance-java-install-dirs: $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)
ifneq ($(JAVA_OBJ_FILES),)
	$(ECHO_NOTHING)$(MKINSTALLDIRS) \
           $(addprefix $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/,$(dir $(JAVA_OBJ_FILES)))$(END_ECHO)
endif

$(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR):
	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)

shared-instance-java-clean:
	$(ECHO_NOTHING)rm -f $(JAVA_OBJ_FILES) \
	      $(ADDITIONAL_JAVA_OBJ_FILES) \
	      $(JAVA_JNI_OBJ_FILES)$(END_ECHO)

shared-instance-java-uninstall:
ifneq ($(JAVA_OBJ_FILES),)
	$(ECHO_NOTHING)for file in $(JAVA_OBJ_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    rm -f $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif
ifneq ($(ADDITIONAL_JAVA_OBJ_FILES),)
	$(ECHO_NOTHING)for file in $(ADDITIONAL_JAVA_OBJ_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    rm -f $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif
ifneq ($(JAVA_PROPERTIES_FILES),)
	$(ECHO_NOTHING)for file in $(JAVA_PROPERTIES_FILES) __done; do \
	  if [ $$file != __done ]; then \
	    rm -f $(GNUSTEP_SHARED_JAVA_INSTALLATION_DIR)/$$file ; \
	  fi; \
	done$(END_ECHO)
endif