]> err.no Git - sope/blob - gnustep-make/rules.make
use %p for pointer formats
[sope] / gnustep-make / rules.make
1 #   -*-makefile-*-
2 #   rules.make
3 #
4 #   All of the common makefile rules.
5 #
6 #   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
7 #
8 #   Author:  Scott Christley <scottc@net-community.com>
9 #   Author:  Ovidiu Predescu <ovidiu@net-community.com>
10 #   Author:  Nicola Pero <nicola@brainstorm.co.uk>
11 #
12 #   This file is part of the GNUstep Makefile Package.
13 #
14 #   This library is free software; you can redistribute it and/or
15 #   modify it under the terms of the GNU General Public License
16 #   as published by the Free Software Foundation; either version 2
17 #   of the License, or (at your option) any later version.
18 #   
19 #   You should have received a copy of the GNU General Public
20 #   License along with this library; see the file COPYING.LIB.
21 #   If not, write to the Free Software Foundation,
22 #   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
24 # prevent multiple inclusions
25
26 # NB: This file is internally protected against multiple inclusions.
27 # But for perfomance reasons, you might want to check the
28 # RULES_MAKE_LOADED variable yourself and include this file only if it
29 # is empty.  That allows make to skip reading the file entirely when it 
30 # has already been read.  We use this trick for all system makefiles.
31 ifeq ($(RULES_MAKE_LOADED),)
32 RULES_MAKE_LOADED=yes
33
34 # Include the Master rules at the beginning because the 'all' rule must be
35 # first on the first invocation without a specified target.
36 ifeq ($(GNUSTEP_INSTANCE),)
37 include $(GNUSTEP_MAKEFILES)/Master/rules.make
38 endif
39
40 #
41 # If INSTALL_AS_USER and/or INSTALL_AS_GROUP are defined, pass them down
42 # to submakes.  There are two reasons - 
43 #
44 # 1. so that if you set them in a GNUmakefile, they get passed down
45 #    to automatically generated sources/GNUmakefiles (such as Java wrappers)
46 # 2. so that if you type `make install INSTALL_AS_USER=nicola' in a directory,
47 #    the INSTALL_AS_USER=nicola gets automatically used in all subdirectories.
48 #
49 # Warning - if you want to hardcode a INSTALL_AS_USER in a GNUmakefile, then
50 # you shouldn't rely on us to pass it down to subGNUmakefiles - you should
51 # rather hardcode INSTALL_AS_USER in all your GNUmakefiles (or better have
52 # a makefile fragment defining INSTALL_AS_USER in the top-level and include
53 # it in all GNUmakefiles) - otherwise what happens is that if you go in a
54 # subdirectory and type 'make install' there, it will not get the 
55 # INSTALL_AS_USER from the higher level GNUmakefile, so it will install with
56 # the wrong user!  For this reason, if you need to hardcode INSTALL_AS_USER
57 # in GNUmakefiles, make sure it's hardcoded *everywhere*.
58 #
59 ifneq ($(INSTALL_AS_USER),)
60   export INSTALL_AS_USER
61 endif
62
63 ifneq ($(INSTALL_AS_GROUP),)
64   export INSTALL_AS_GROUP
65 endif
66
67
68 # In subprojects, will be set by the recursive make invocation on the
69 # make command line to be [../../]../derived_src
70 DERIVED_SOURCES = derived_src
71 DERIVED_SOURCES_DIR = $(GNUSTEP_BUILD_DIR)/$(DERIVED_SOURCES)
72
73 # Always include all the compilation flags and generic compilation
74 # rules, because the user, in his GNUmakefile.postamble, might want to
75 # add manual commands for example to after-all, which are processed
76 # during the Master invocation, but yet can compile or install stuff
77 # and need access to all compilation/installation flags and locations
78 # and basic rules.
79
80 #
81 # Manage stripping
82 #
83 ifeq ($(strip),yes)
84 INSTALL_PROGRAM += -s
85 export strip
86 endif
87
88 #
89 # Prepare the arguments to install to set user/group of installed files
90 #
91 INSTALL_AS = 
92
93 ifneq ($(INSTALL_AS_USER),)
94 INSTALL_AS += -o $(INSTALL_AS_USER)
95 endif
96
97 ifneq ($(INSTALL_AS_GROUP),)
98 INSTALL_AS += -g $(INSTALL_AS_GROUP)
99 endif
100
101 # Redefine INSTALL to include these flags.  This automatically
102 # redefines INSTALL_DATA and INSTALL_PROGRAM as well, because they are
103 # define in terms of INSTALL.
104 INSTALL += $(INSTALL_AS)
105
106 # Sometimes, we install without using INSTALL - typically using tar.
107 # In those cases, we run chown after having installed, in order to
108 # fixup the user/group.
109
110 #
111 # Prepare the arguments to chown to set user/group of installed files.
112 #
113 ifneq ($(INSTALL_AS_GROUP),)
114 CHOWN_TO = $(strip $(INSTALL_AS_USER)).$(strip $(INSTALL_AS_GROUP))
115 else 
116 CHOWN_TO = $(strip $(INSTALL_AS_USER))
117 endif
118
119 # You need to run CHOWN manually, but only if CHOWN_TO is non-empty.
120
121 #
122 # Pass the CHOWN_TO argument to MKINSTALLDIRS
123 # All installation directories should be created using MKINSTALLDIRS
124 # to make sure we set the correct user/group.  Local directories should
125 # be created using MKDIRS instead because we don't want to set user/group.
126 #
127 ifneq ($(CHOWN_TO),)
128  MKINSTALLDIRS = $(MKDIRS) -c $(CHOWN_TO)
129  # Fixup the library installation commands if needed so that we change
130  # ownership of the links as well
131  ifeq ($(shared),yes)
132   AFTER_INSTALL_LIBRARY_CMD += ; $(AFTER_INSTALL_SHARED_LIB_CHOWN)
133  endif
134 else
135  MKINSTALLDIRS = $(MKDIRS)
136 endif
137
138 #
139 # If this is part of the compilation of a framework,
140 # add -I[$GNUSTEP_BUILD_DIR][../../../etc]derived_src so that the code
141 # can include framework headers simply using `#include
142 # <MyFramework/MyHeader.h>'
143 #
144 # If it's a framework makefile, FRAMEWORK_NAME will be non-empty.  If
145 # it's a framework subproject, OWNING_PROJECT_HEADER_DIR_NAME will be
146 # non-empty.
147 #
148 ifneq ($(FRAMEWORK_NAME)$(OWNING_PROJECT_HEADER_DIR_NAME),)
149   DERIVED_SOURCES_HEADERS_FLAG = -I$(DERIVED_SOURCES_DIR)
150 endif
151
152 #
153 # Include rules to built the instance
154 #
155 # this fixes up ADDITIONAL_XXXFLAGS as well, which is why we include it
156 # before using ADDITIONAL_XXXFLAGS
157 #
158 ifneq ($(GNUSTEP_INSTANCE),)
159 include $(GNUSTEP_MAKEFILES)/Instance/rules.make
160 endif
161
162 #
163 # Implement ADDITIONAL_NATIVE_LIBS
164 #
165 # A native lib is a framework on apple, and a shared library
166 # everywhere else.  Here we provide the appropriate link flags
167 # to support it transparently on the two platforms.
168 #
169 ifeq ($(FOUNDATION_LIB),apple)
170   ADDITIONAL_OBJC_LIBS += $(foreach lib,$(ADDITIONAL_NATIVE_LIBS),-framework $(lib))
171 else
172   ADDITIONAL_OBJC_LIBS += $(foreach lib,$(ADDITIONAL_NATIVE_LIBS),-l$(lib))
173 endif
174
175 #
176 # Auto dependencies
177 #
178 # -MMD -MP tells gcc to generate a .d file for each compiled file, 
179 # which includes makefile rules adding dependencies of the compiled
180 # file on all the header files the source file includes ...
181 #
182 # next time `make' is run, we include the .d files for the previous
183 # run (if we find them) ... this automatically adds dependencies on
184 # the appropriate header files 
185 #
186
187 # Warning - the following variable name might change
188 ifeq ($(AUTO_DEPENDENCIES),yes)
189 ifeq ($(AUTO_DEPENDENCIES_FLAGS),)
190   AUTO_DEPENDENCIES_FLAGS = -MMD -MP
191 endif
192 endif
193
194 # The difference between ADDITIONAL_XXXFLAGS and AUXILIARY_XXXFLAGS is the
195 # following:
196 #
197 #  ADDITIONAL_XXXFLAGS are set freely by the user GNUmakefile
198 #
199 #  AUXILIARY_XXXFLAGS are set freely by makefile fragments installed by
200 #                     auxiliary packages.  For example, gnustep-db installs
201 #                     a gdl.make file.  If you want to use gnustep-db in
202 #                     your tool, you `include $(GNUSTEP_MAKEFILES)/gdl.make'
203 #                     and that will add the appropriate flags to link against
204 #                     gnustep-db.  Those flags are added to AUXILIARY_XXXFLAGS.
205 #
206 # Why can't ADDITIONAL_XXXFLAGS and AUXILIARY_XXXFLAGS be the same variable ?
207 # Good question :-) I'm not sure but I think the original reason is that 
208 # users tend to think they can do whatever they want with ADDITIONAL_XXXFLAGS,
209 # like writing 
210 # ADDITIONAL_XXXFLAGS = -Verbose
211 # (with a '=' instead of a '+=', thus discarding the previous value of
212 # ADDITIONAL_XXXFLAGS) without caring for the fact that other makefiles 
213 # might need to add something to ADDITIONAL_XXXFLAGS.
214 #
215 # So the idea is that ADDITIONAL_XXXFLAGS is reserved for the users to
216 # do whatever mess they like with them, while in makefile fragments
217 # from packages we use a different variable, which is subject to a stricter 
218 # control, requiring package authors to always write
219 #
220 #  AUXILIARY_XXXFLAGS += -Verbose
221 #
222 # in their auxiliary makefile fragments, to make sure they don't
223 # override flags from different packages, just add to them.
224 #
225 # When building up command lines inside gnustep-make, we always need
226 # to add both AUXILIARY_XXXFLAGS and ADDITIONAL_XXXFLAGS to all
227 # compilation/linking/etc command.
228 #
229
230 ALL_CPPFLAGS = $(AUTO_DEPENDENCIES_FLAGS) $(CPPFLAGS) $(ADDITIONAL_CPPFLAGS) \
231                $(AUXILIARY_CPPFLAGS)
232
233 ALL_OBJCFLAGS = $(INTERNAL_OBJCFLAGS) $(ADDITIONAL_OBJCFLAGS) \
234    $(AUXILIARY_OBJCFLAGS) $(ADDITIONAL_INCLUDE_DIRS) \
235    $(AUXILIARY_INCLUDE_DIRS) \
236    $(DERIVED_SOURCES_HEADERS_FLAG) \
237    -I. $(SYSTEM_INCLUDES) \
238    $(GNUSTEP_HEADERS_FLAGS) \
239    $(GNUSTEP_FRAMEWORKS_FLAGS)
240
241 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(ADDITIONAL_CFLAGS) \
242    $(AUXILIARY_CFLAGS) $(ADDITIONAL_INCLUDE_DIRS) \
243    $(AUXILIARY_INCLUDE_DIRS) \
244    $(DERIVED_SOURCES_HEADERS_FLAG) \
245    -I. $(SYSTEM_INCLUDES) \
246    $(GNUSTEP_HEADERS_FLAGS) \
247    $(GNUSTEP_FRAMEWORKS_FLAGS)
248
249 ALL_AOT_JAVAFLAGS = $(INTERNAL_AOT_JAVAFLAGS) $(ADDITIONAL_AOT_JAVAFLAGS) \
250    $(AUXILIARY_AOT_JAVAFLAGS) $(ADDITIONAL_INCLUDE_DIRS) \
251    $(AUXILIARY_INCLUDE_DIRS) \
252    $(DERIVED_SOURCES_HEADERS_FLAG) \
253    -I. $(SYSTEM_INCLUDES) \
254    $(GNUSTEP_HEADERS_FLAGS) \
255    $(GNUSTEP_FRAMEWORKS_FLAGS)
256
257 # if you need, you can define ADDITIONAL_CCFLAGS to add C++ specific flags
258 ALL_CCFLAGS = $(ADDITIONAL_CCFLAGS) $(AUXILIARY_CCFLAGS)
259
260 INTERNAL_CLASSPATHFLAGS = -classpath ./$(subst ::,:,:$(strip $(ADDITIONAL_CLASSPATH)):)$(CLASSPATH)
261
262 ALL_JAVACFLAGS = $(INTERNAL_CLASSPATHFLAGS) $(INTERNAL_JAVACFLAGS) \
263 $(ADDITIONAL_JAVACFLAGS) $(AUXILIARY_JAVACFLAGS)
264
265 ALL_JAVAHFLAGS = $(INTERNAL_CLASSPATHFLAGS) $(ADDITIONAL_JAVAHFLAGS) \
266 $(AUXILIARY_JAVAHFLAGS)
267
268 ifeq ($(shared),no)
269   ALL_LDFLAGS = $(STATIC_LDFLAGS)
270 else
271   ALL_LDFLAGS =
272 endif
273 ALL_LDFLAGS += $(ADDITIONAL_LDFLAGS) $(AUXILIARY_LDFLAGS) $(GUI_LDFLAGS) \
274                $(BACKEND_LDFLAGS) $(SYSTEM_LDFLAGS) $(INTERNAL_LDFLAGS)
275
276 ALL_LIB_DIRS = $(ADDITIONAL_FRAMEWORK_DIRS) $(AUXILIARY_FRAMEWORK_DIRS) \
277    $(ADDITIONAL_LIB_DIRS) $(AUXILIARY_LIB_DIRS) \
278    $(GNUSTEP_LIBRARIES_FLAGS) \
279    $(GNUSTEP_FRAMEWORKS_FLAGS) \
280    $(SYSTEM_LIB_DIR)
281
282 # We use .plist (property-list files, see gnustep-base) in quite a few
283 # cases.  Whenever a .plist file is required, you can/will be allowed
284 # to provide a .cplist file instead (at the moment, it is only
285 # implemented for applications' xxxInfo.plist).  A .cplist file is a
286 # property-list file with C preprocessor conditionals.  gnustep-make
287 # will automatically generate the .plist file from the .cplist file by
288 # running the C preprocessor.
289
290 # The CPLISTFLAGS are the flags used when running the C preprocessor
291 # to generate a .plist file from a .cplist file.
292 ALL_CPLISTFLAGS = -P -x c -traditional
293
294 ifeq ($(FOUNDATION_LIB), gnu)
295   ALL_CPLISTFLAGS += -DGNUSTEP
296 else
297   ifeq ($(FOUNDATION_LIB), apple)
298     ALL_CPLISTFLAGS += -DAPPLE
299   else
300       ifeq ($(FOUNDATION_LIB), nx)
301         ALL_CPLISTFLAGS += -DNEXT
302       else
303         ALL_CPLISTFLAGS += -DUNKNOWN
304       endif
305   endif
306 endif
307
308 ALL_CPLISTFLAGS += $(ADDITIONAL_CPLISTFLAGS) $(AUXILIARY_CPLISTFLAGS)
309
310
311 # If we are using Windows32 DLLs, we pass -DGNUSTEP_WITH_DLL to the
312 # compiler.  This preprocessor define might be used by library header
313 # files to know they are included from external code needing to use
314 # the library symbols, so that the library header files can in this
315 # case use __declspec(dllimport) to mark symbols as needing to be put
316 # into the import table for the executable/library/whatever that is
317 # being compiled.
318 #
319 # In the new DLL support, this is usually no longer needed.  The
320 # compiler does it all automatically.  But in some cases, some symbols
321 # can not be automatically imported and you might want to declare them
322 # specially.  For those symbols, this define is handy.
323 #
324 ifeq ($(BUILD_DLL),yes)
325 ALL_CPPFLAGS += -DGNUSTEP_WITH_DLL
326 endif
327
328 # General rules
329 VPATH = .
330
331 # Disable all built-in suffixes for performance.
332 .SUFFIXES:
333
334 # Then define our own.
335 .SUFFIXES: .m .c .psw .java .h .cpp .cxx .C .cc .cp
336
337 .PRECIOUS: %.c %.h $(GNUSTEP_OBJ_DIR)/%${OEXT}
338
339 # Disable all built-in rules with a vague % as target, for performance.
340 %: %.c
341
342 %: %.cpp
343
344 %: %.cc
345
346 %: %.C
347
348 (%): %
349
350 %:: %,v
351
352 %:: RCS/%,v
353
354 %:: RCS/%
355
356 %:: s.%
357
358 %:: SCCS/s.%
359
360 #
361 # In exceptional conditions, you might need to want to use different compiler
362 # flags for a file (for example, if a file doesn't compile with optimization
363 # turned on, you might want to compile that single file with optimizations
364 # turned off).  gnustep-make allows you to do this - you can specify special 
365 # flags to be used when compiling a *specific* file in two ways - 
366 #
367 # xxx_FILE_FLAGS (where xxx is the file name, such as main.m) 
368 #                are special compilation flags to be used when compiling xxx
369 #
370 # xxx_FILE_FILTER_OUT_FLAGS (where xxx is the file name, such as mframe.m)
371 #                is a filter-out make pattern of flags to be filtered out 
372 #                from the compilation flags when compiling xxx.
373 #
374 # Typical examples:
375 #
376 # Disable optimization flags for the file NSInvocation.m:
377 # NSInvocation.m_FILE_FILTER_OUT_FLAGS = -O%
378 #
379 # Disable optimization flags for the same file, and also remove 
380 # -fomit-frame-pointer:
381 # NSInvocation.m_FILE_FILTER_OUT_FLAGS = -O% -fomit-frame-pointer
382 #
383 # Force the compiler to warn for #import if used in file file.m:
384 # file.m_FILE_FLAGS = -Wimport
385 # file.m_FILE_FILTER_OUT_FLAGS = -Wno-import
386 #
387
388 # Please don't be scared by the following rules ... In normal
389 # situations, $<_FILTER_OUT_FLAGS is empty, and $<_FILE_FLAGS is empty
390 # as well, so the following rule is simply equivalent to
391 # $(CC) $< -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@
392 # and similarly all the rules below
393 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.c
394         $(ECHO_COMPILING)$(CC) $< -c \
395               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
396                                                         $(ALL_CFLAGS)) \
397               $($<_FILE_FLAGS) -o $@$(END_ECHO)
398
399 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.m
400         $(ECHO_COMPILING)$(CC) $< -c \
401               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
402                                                         $(ALL_OBJCFLAGS)) \
403               $(PCH_INCLUDE_FLAG) \
404               $($<_FILE_FLAGS) -o $@$(END_ECHO)
405
406 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.java
407         $(ECHO_COMPILING)$(CC) $< -c \
408               $(filter-out -D%,$(ALL_CPPFLAGS) $(ALL_AOT_JAVAFLAGS)) \
409               $(PCH_INCLUDE_FLAG) \
410               $($<_FILE_FLAGS) -o $@$(END_ECHO)
411
412 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.C
413         $(ECHO_COMPILING)$(CC) $< -c \
414               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
415                                                         $(ALL_CFLAGS)   \
416                                                         $(ALL_CCFLAGS)) \
417               $($<_FILE_FLAGS) -o $@$(END_ECHO)
418
419 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.cc
420         $(ECHO_COMPILING)$(CC) $< -c \
421               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
422                                                         $(ALL_CFLAGS)   \
423                                                         $(ALL_CCFLAGS)) \
424               $($<_FILE_FLAGS) -o $@$(END_ECHO)
425
426 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.cpp
427         $(ECHO_COMPILING)$(CC) $< -c \
428               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
429                                                         $(ALL_CFLAGS)   \
430                                                         $(ALL_CCFLAGS)) \
431               $($<_FILE_FLAGS) -o $@$(END_ECHO)
432
433 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.cxx
434         $(ECHO_COMPILING)$(CC) $< -c \
435               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
436                                                         $(ALL_CFLAGS)   \
437                                                         $(ALL_CCFLAGS)) \
438               $($<_FILE_FLAGS) -o $@$(END_ECHO)
439
440 $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.cp
441         $(ECHO_COMPILING)$(CC) $< -c \
442               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
443                                                         $(ALL_CFLAGS)   \
444                                                         $(ALL_CCFLAGS)) \
445               $($<_FILE_FLAGS) -o $@$(END_ECHO)
446
447 # precompiled header files
448 # TODO: should go into GNUSTEP_OBJ_DIR?
449 # TODO: we need to create the derived_src here because there is no rule yet
450 #       in the include path?
451 GCH_SUFFIX=.h.gch
452 $(DERIVED_SOURCES_DIR)/%$(GCH_SUFFIX): %.h
453         $(ECHO_NOTHING)if ! test -d $(DERIVED_SOURCES_DIR); then \
454           $(MKDIRS) $(DERIVED_SOURCES_DIR); \
455         fi$(END_ECHO)
456         $(ECHO_COMPILING)$(CC) -x objective-c-header $< -c \
457               $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
458                                                         $(ALL_OBJCFLAGS)) \
459               $($<_FILE_FLAGS) -o $@$(END_ECHO)
460
461 %.class : %.java
462         $(ECHO_COMPILING)$(JAVAC) \
463                  $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_JAVACFLAGS)) \
464                  $($<_FILE_FLAGS) $<$(END_ECHO)
465
466 # A jni header file which is created using JAVAH
467 # Example of how this rule will be applied: 
468 # gnu/gnustep/base/NSObject.h : gnu/gnustep/base/NSObject.java
469 #       javah -o gnu/gnustep/base/NSObject.h gnu.gnustep.base.NSObject
470 %.h : %.java
471         $(ECHO_JAVAHING)$(JAVAH) \
472                  $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_JAVAHFLAGS)) \
473                  $($<_FILE_FLAGS) -o $@ $(subst /,.,$*)$(END_ECHO)
474
475 %.c : %.psw
476         pswrap -h $*.h -o $@ $<
477
478 # The following rule is needed because in frameworks you might need
479 # the .h files before the .c files are compiled.
480 %.h : %.psw
481         pswrap -h $@ -o $*.c $<
482
483 # Rule to generate a .plist file (a property list file) by running the
484 # preprocessor on a .cplist file (a property list file with embedded C
485 # preprocessor conditionals).  Useful in order to have a single
486 # xxxInfo.plist file for multiple platforms (read GNUstep and Apple)
487 # for the same application (to make portability easier).  You can have
488 # a single xxxInfo.cplist file, and xxxInfo.plist will automatically
489 # be generated by gnustep-make from xxxInfo.cplist by running the
490 # preprocessor.
491 #
492 # Unfortunately, on some platforms (Apple) the preprocessor emits
493 # unwanted and unrequested #pragma statements.  We use sed to filter
494 # them out.
495 #
496 %.plist : %.cplist
497         $(ECHO_PREPROCESSING)$(CPP) \
498                   $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPLISTFLAGS))\
499                   $($<_FILE_FLAGS) $< | sed '/^#pragma/d' > $@$(END_ECHO)
500
501 # The following rule builds a .c file from a lex .l file.
502 # You can define LEX_FLAGS if you need them.
503 %.c: %.l
504         $(LEX) $(LEX_FLAGS) -t $< > $@
505
506 # The following rule builds a .c file from a yacc/bison .y file.
507 # You can define YACC_FLAGS if you need them.
508 %.c: %.y
509         $(YACC) $(YACC_FLAGS) $<
510         mv -f y.tab.c $@
511
512 #
513 # Special mingw32 specific rules to compile Windows resource files (.rc files)
514 # into object files.
515 #
516 ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
517 # Add the .rc suffix on Windows.
518 .SUFFIXES: .rc
519
520 # A rule to generate a .o file from the .rc file.
521 $(GNUSTEP_OBJ_DIR)/%${OEXT}: %.rc
522         $(ECHO_COMPILING)windres $< $@$(END_ECHO)
523 endif
524
525
526 # The following dummy rules are needed for performance - we need to
527 # prevent make from spending time trying to compute how/if to rebuild
528 # the system makefiles!  the following rules tell him that these files
529 # are always up-to-date
530
531 $(GNUSTEP_MAKEFILES)/*.make: ;
532
533 $(GNUSTEP_MAKEFILES)/$(GNUSTEP_TARGET_DIR)/config.make: ;
534
535 $(GNUSTEP_MAKEFILES)/Additional/*.make: ;
536
537 $(GNUSTEP_MAKEFILES)/Master/*.make: ;
538
539 $(GNUSTEP_MAKEFILES)/Instance/*.make: ;
540
541 $(GNUSTEP_MAKEFILES)/Instance/Shared/*.make: ;
542
543 $(GNUSTEP_MAKEFILES)/Instance/Documentation/*.make: ;
544
545 # The rule to create the GNUSTEP_BUILD_DIR if any.
546 ifneq ($(GNUSTEP_BUILD_DIR),.)
547 $(GNUSTEP_BUILD_DIR):
548         $(ECHO_CREATING)$(MKDIRS) $(GNUSTEP_BUILD_DIR)$(END_ECHO)
549 endif
550
551 # The rule to create the objects file directory.
552 $(GNUSTEP_OBJ_DIR):
553         $(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
554         $(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME); \
555         $(RM_LN_S) obj; \
556         $(LN_S) ./$(GNUSTEP_OBJ_DIR_NAME) obj$(END_ECHO)
557
558 endif
559 # rules.make loaded