1 #############################################################################
2 #############################################################################
4 ## Here are the mmakefile macros that are used as commands in the body ##
6 ## They are used to help the portability of mmakefiles to different ##
7 ## platforms and also will handle the error handling in a standard way. ##
9 #############################################################################
10 #############################################################################
12 #------------------------------------------------------------------------------
13 # Compile the file %(from) to %(to) with %(cmd). Write any errors to %(err)
14 # and use the options in %(opt).
15 %define compile_q cmd=$(TARGET_CC) opt=$(CFLAGS) from=$< to=$@
16 @$(ECHO) "Compiling $(notdir %(from))"
17 @$(IF) %(cmd) %(opt) -c %(from) -o %(to) > $(GENDIR)/cerrors 2>&1 ; then \
18 $(IF) $(TEST) -s $(GENDIR)/cerrors ; then \
19 $(ECHO) "%(from): %(cmd) %(opt) -c %(from) -o %(to)" >> $(GENDIR)/errors ; \
20 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors ; \
25 $(ECHO) "Compile failed: %(cmd) %(opt) -c %(from) -o %(to)" 1>&2 ; \
26 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors 1>&2 ; \
30 #------------------------------------------------------------------------------
33 #------------------------------------------------------------------------------
34 # Assemble the file %(from) to %(to) with %(cmd) with the options in %(opt).
35 %define assemble_q cmd=$(CC) opt=$(AFLAGS) from=$< to=$@
36 @$(ECHO) "Assembling $(notdir %(from))..."
37 @$(IF) %(cmd) %(opt) %(from) -o %(to) > $(GENDIR)/cerrors 2>&1 ; then \
38 $(IF) $(TEST) -s $(GENDIR)/cerrors ; then \
39 $(ECHO) "$(notdir %(from)): %(cmd) %(opt) %(from) -o %(to)" >> $(GENDIR)/errors ; \
40 $(CAT) $(GENDIR)/cerrors >> $(GENDIR)/errors ; \
45 $(ECHO) "Assemble failed: %(cmd) %(opt) %(from) -o %(to)" 1>&2 ; \
46 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors 1>&2 ; \
50 #-------------------------------------------------------------------------
53 #------------------------------------------------------------------------------
54 # Link a specified number of objects to an executable
55 %define link_q cmd=$(AROS_CC) opt=$(LDFLAGS) from=$< to=$@ libs=$(LIBS)
56 @$(ECHO) "Linking %(to)..."
57 @$(IF) %(cmd) %(opt) %(from) -o %(to) %(libs) 2>&1 > $(GENDIR)/cerrors 2>&1 ; then \
58 $(IF) $(TEST) -s $(GENDIR)/cerrors ; then \
59 $(ECHO) "%(to): %(cmd) %(opt) %(from) -o %(to) %(libs)" >> $(GENDIR)/errors ; \
60 $(CAT) $(GENDIR)/cerrors >> $(GENDIR)/errors ; \
65 $(ECHO) "Link failed: %(cmd) %(opt) %(from) -o %(to) %(libs)" 1>&2 ; \
66 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors 1>&2 ; \
72 #-------------------------------------------------------------------------
73 # Link a module based upon a number of arguments and the standard $(LIBS)
74 # and $(DEPLIBS) make variables.
76 %define link_module_q err="$(notdir $@).err" objs=/A endtag= module=$(MODULE) ldflags=$(LDFLAGS) libs=$(LIBS) objdir=$(OBJDIR)
77 @$(ECHO) "Building $(notdir $@) ..."
78 @if $(AROS_CC) $(NOSTARTUP_LDFLAGS) %(ldflags) \
79 $(GENMAP) %(objdir)/%(module).map \
80 %(objs) %(libs) %(endtag) \
81 -o $@ 2>&1 > %(objdir)/%(err); \
83 cat %(objdir)/%(err); \
85 cat %(objdir)/%(err); \
89 @if $(TEST) ! -s %(objdir)/%(err) ; then $(RM) %(objdir)/%(err) ; fi
92 #------------------------------------------------------------------------------
94 #------------------------------------------------------------------------------
96 %define mklib_q ar=$(AR) ranlib=$(RANLIB) to=$@ from=$(OBJS)
97 @$(ECHO) "Creating library %(to)..."
102 #------------------------------------------------------------------------------
103 # Create the dependency file %(to) for %(from)
104 %define mkdepend_q flags=$(CFLAGS) from=$< to=$@ cc=$(AROS_CC)
105 %mkdir_q dir="$(dir %(to))"
106 @$(ECHO) "Makedepend $(CURDIR)/$(notdir %(from))..."
107 @AROS_CC="%(cc)" $(MKDEPEND) %(flags) %(from) -o %(to)
109 #------------------------------------------------------------------------------
111 #------------------------------------------------------------------------------
112 # Create the function reference file %(to) to %(from)
113 %define mkref_q cc=$(AROS_CC) cppflags="-E -C -dD -D__CXREF__" cflags=$(CFLAGS) from=$< to=$@
114 @$(ECHO) "Generating ref for $(notdir %(from))..."
115 @$(CXREF) -raw -CPP '%(cc) %(cppflags) %(cflags)' %(from) >%(to) 2>$(GENDIR)/cerrors
116 @$(IF) $(TEST) -s %(to) ; \
118 $(IF) $(TEST) -s $(GENDIR)/cerrors ; then \
119 $(ECHO) "%(from): $(CXREF) -raw -CPP '%(cc) %(cppflags) %(cflags)' %(from) >%(to)" >> $(GENDIR)/errors ; \
120 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors ; \
123 $(ECHO) "Reference generation failed: $(CXREF) -raw -CPP '%(cc) %(cppflags) %(cflags)' %(from) >%(to)" 1>&2 ; \
124 tee < $(GENDIR)/cerrors -a $(GENDIR)/errors 1>&2 ; \
130 #------------------------------------------------------------------------------
131 # Create one directory without any output
132 %define mkdir_q dir=.
133 @$(IF) $(TEST) ! -d %(dir) ; then $(MKDIR) %(dir) ; else $(NOP) ; fi
136 #------------------------------------------------------------------------------
137 # Create several directories without any output
138 %define mkdirs_q dirs=/M
139 @$(FOR) dir in %(dirs) ; do \
140 $(IF) $(TEST) ! -d $$dir ; then $(MKDIR) $$dir ; else $(NOP) ; fi ; \
144 #############################################################################
145 #############################################################################
147 ## Here are the mmakefile macro's that are used to do certain tasks in a ##
148 ## mmakefile. They consist of one or more full makefile rules. ##
149 ## In general the files generated in these macro's are also defined as ##
150 ## make targets so that they can be used as a dependency in other rules ##
152 #############################################################################
153 #############################################################################
155 #------------------------------------------------------------------------------
156 # Generate a unique id for each of the %build... rules
157 %define buildid targets=/A
159 ifneq ($(filter $(TARGET),%(targets)),)
160 BDTARGETID := $(BDID)
163 #------------------------------------------------------------------------------
166 #------------------------------------------------------------------------------
167 # Copy file %(from) to %(to) in a makefile rule
168 %define rule_copy from=/A to=/A
172 #------------------------------------------------------------------------------
175 #------------------------------------------------------------------------------
176 # Copy the files %(files) to %(targetdir). For each file in %(files),
177 # %(srcdir)/file is copied to %(targetdir)/file. The targetdir and the
178 # appropriate subdirs are not generated by this rule so they have to be
180 %define rule_copy_multi files=/A targetdir=/A srcdir=.
182 $(addprefix %(targetdir)/,%(files)) : %(targetdir)/% : %(srcdir)/%
185 #------------------------------------------------------------------------------
187 #------------------------------------------------------------------------------
188 # Copy the files %(files) to %(targetdir). For each file in %(files),
189 # %(srcdir)/file is copied to %(targetdir)/file if these files are different.
190 # %(stampfile) is used to keep track of when the last time the comparison has
191 # been done. The targetdir and the appropriate subdirs are not generated by
192 # this rule so they have to be present.
193 %define rule_copy_diff_multi files=/A targetdir=/A srcdir=. \
194 stampfile=$(TMP_SRCDIR)/.copy_stamp
196 TMP_SRCDIR := %(srcdir)
198 $(addprefix %(targetdir)/,%(files)) : | %(stampfile)
200 %(stampfile) : SRCDIR := %(srcdir)
201 %(stampfile) : TGTDIR := %(targetdir)
202 %(stampfile) : FILES := %(files)
203 %(stampfile) : $(addprefix %(srcdir)/,%(files))
204 @for f in $(FILES); do \
205 $(IF) ! $(CMP) -s $(SRCDIR)/$$f $(TGTDIR)/$$f ; then \
206 $(CP) $(SRCDIR)/$$f $(TGTDIR)/$$f ; \
211 #------------------------------------------------------------------------------
213 #------------------------------------------------------------------------------
214 # Will join all the files in %(from) to %(to). When text is specified it will
216 # Restriction: at the moment when using a non-empty target dir %(from) may
218 %define rule_join to=/A from=/A text=
226 #------------------------------------------------------------------------------
229 #------------------------------------------------------------------------------
230 # Include the dependency files and add some internal rules
231 # When depstargets is provided the depencies will only be included when one of
232 # these targets is the $(TARGET). Otherwise the dependencies will only be
233 # include when the $(TARGET) is not for setup or clean
234 %define include_deps deps=$(DEPS)/M depstargets=
236 ifneq (%(depstargets),)
237 ifneq ($(findstring $(TARGET),%(depstargets)),)
241 ifeq (,$(filter clean% %clean %clean% setup% includes% %setup,$(TARGET)))
247 #------------------------------------------------------------------------------
250 #------------------------------------------------------------------------------
251 # Create the directories %(dirs). The creation will be done by adding rules to
252 # the %(setuptarget) make target with setup as the default.
253 %define rule_makedirs dirs=/A setuptarget=setup
255 %(setuptarget) :: %(dirs)
257 GLOB_MKDIRS += %(dirs)
260 #------------------------------------------------------------------------------
263 #------------------------------------------------------------------------------
264 # Generate a rule to compile a C source file to an object file and generate
265 # the dependency file. Basename may contain a directory part, then the source
266 # file has to be in that directory. The generated file will be put in the
267 # object directory without the directory.
269 # - basename: the basename of the file to compile. Use % for a wildcard rule
270 # - cflags (default $(CFLAGS)): the C flags to use for compilation
271 # - dflags: the flags used during creation of dependency file. If not specified
272 # the same value as cflags will be used
273 # - targetdir: the directory to put the .o file and the .d file. By default
274 # it is put in the same directory as the .c file
275 %define rule_compile basename=/A cflags=$(CFLAGS) dflags= targetdir= compiler=target
278 TMP_TARGETBASE := %(basename)
280 TMP_TARGETBASE := %(targetdir)/$(notdir %(basename))
283 ifeq ($(findstring %(compiler),host target),)
284 $(error unknown compiler %(compiler))
286 ifeq (%(compiler),target)
287 $(TMP_TARGETBASE).o : TMP_CMD:=$(TARGET_CC)
288 $(TMP_TARGETBASE).d : TMP_CMD:=$(TARGET_CC)
290 ifeq (%(compiler),host)
291 $(TMP_TARGETBASE).o : TMP_CMD:=$(HOST_CC)
292 $(TMP_TARGETBASE).d : TMP_CMD:=$(HOST_CC)
295 $(TMP_TARGETBASE).o : CFLAGS := %(cflags)
296 $(TMP_TARGETBASE).o : %(basename).c
297 %compile_q cmd=$(TMP_CMD)
300 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(cflags)
302 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(dflags)
304 $(TMP_TARGETBASE).d : %(basename).c
305 %mkdepend_q cc=$(TMP_CMD) flags=$(TMP_DFLAGS)
307 #------------------------------------------------------------------------------
310 #------------------------------------------------------------------------------
311 # Generate a rule to compile multiple C source files to an object file and
312 # generate the corresponding dependency files. The generated file will be put
313 # in the object directory without the directory part of the source file.
315 # - basenames: the basenames of the files to compile. The names may include
316 # relative or absolute path names. No wildcard is allowed
317 # - cflags (default $(CFLAGS)): the C flags to use for compilation
318 # - dflags: the flags used during creation of dependency file. If not specified
319 # the same value as cflags will be used
320 # - targetdir: the directory to put the .o file and the .d file. By default
321 # it is put in the same directory as the .c file. When targetdir is not
322 # empty, path names will be stripped from the file names so that all files
323 # are in that dir and not in subdirectories.
324 # - compiler (default target): compiler to use, either target or host
325 %define rule_compile_multi basenames=/A cflags=$(CFLAGS) dflags= targetdir= \
329 TMP_TARGETS := $(addsuffix .o,%(basenames))
330 TMP_DTARGETS := $(addsuffix .d,%(basenames))
333 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
334 TMP_DTARGETS := $(addsuffix .d,$(addprefix %(targetdir)/,$(notdir %(basenames))))
335 TMP_WILDCARD := %(targetdir)/%
337 # Be sure that all .c files are generated
338 $(TMP_TARGETS) $(TMP_DTARGETS) : | $(addsuffix .c,%(basenames))
340 # Be sure that all .c files are found
341 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
343 vpath %.c $(TMP_DIRS)
348 ifeq ($(findstring %(compiler),host target),)
349 $(error unknown compiler %(compiler))
351 ifeq (%(compiler),target)
352 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(TARGET_CC)
354 ifeq (%(compiler),host)
355 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(HOST_CC)
358 $(TMP_TARGETS) : CFLAGS := %(cflags)
359 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %.c
360 %compile_q cmd=$(CMD)
363 $(TMP_DTARGETS) : DFLAGS:=%(cflags)
365 $(TMP_DTARGETS) : DFLAGS:=%(dflags)
367 $(TMP_DTARGETS) : $(TMP_WILDCARD).d : %.c
368 %mkdepend_q cc=$(CMD) flags=$(DFLAGS)
370 #------------------------------------------------------------------------------
373 #------------------------------------------------------------------------------
374 # Make an alias from one arch specific build to another arch.
376 # - mainmmake: the mmake of the module in the main tree
377 # - arch: the current arch
378 # - alias: the alias to which this should point
379 %define rule_archalias mainmmake=\A arch=\A alias=\A
381 #MM- %(mainmmake)-%(arch) : %(mainmmake)-%(alias)
383 #------------------------------------------------------------------------------
386 #------------------------------------------------------------------------------
387 # Generate a rule to compile a C source file to a shared object file with a
388 # .so suffix. Basename may contain a directory part, then the source
389 # file has to be in that directory. The generated file will be put in the
390 # object directory without the directory.
392 # - basename: the basename of the file to compile. Use % for a wildcard rule
393 # - cflags (default $(CFLAGS)): the C flags to use for compilation
394 # - targetdir: the directory to put the .o file and the .d file. By default
395 # it is put in the same directory as the .c file
396 %define rule_compile_shared basename=/A cflags=$(CFLAGS) targetdir= compiler=target
399 TMP_TARGETBASE := %(basename)
401 TMP_TARGETBASE := %(targetdir)/$(notdir %(basename))
404 ifeq ($(findstring %(compiler),host target),)
405 $(error unknown compiler %(compiler))
407 ifeq (%(compiler),target)
408 $(TMP_TARGETBASE).so : TMP_CMD:=$(TARGET_CC)
410 ifeq (%(compiler),host)
411 $(TMP_TARGETBASE).so : TMP_CMD:=$(HOST_CC)
414 $(TMP_TARGETBASE).so : %(basename).c
415 %compile_q opt="$(SHARED_CFLAGS) %(cflags)" cmd=$(TMP_CMD)
417 #------------------------------------------------------------------------------
420 #------------------------------------------------------------------------------
421 # Generate a rule to assemble a source file to an object file. Basename may
422 # contain a directory part, then the source file has to be in that directory.
423 # The generated file will be put in the object directory without the directory.
425 # - basename: the basename of the file to compile. Use % for a wildcard rule
426 # - flags (default $(AFLAGS)): the asm flags to use for assembling
427 # - targetdir: the directory to put the .o file in. By default it is put in the
428 # same directory as the .s file
429 %define rule_assemble basename=/A aflags=$(AFLAGS) targetdir=
432 %(basename).o : AFLAGS := %(aflags)
433 %(basename).o : %(basename).s
437 %(targetdir)/$(notdir %(basename)).o : AFLAGS := %(aflags)
438 %(targetdir)/$(notdir %(basename)).o : %(basename).s
443 #------------------------------------------------------------------------------
446 #------------------------------------------------------------------------------
447 # Generate a rule to assemble multiple source files to an object file. The
448 # generated file will be put in the object directory with the directory part
449 # of the source file stripped off.
451 # - basenames: the basenames of the files to compile. The names may include
452 # relative or absolute path names. No wildcard is allowed
453 # - aflags (default $(AFLAGS)): the flags to use for assembly
454 # - targetdir: the directory to put the .o file and the .d file. By default
455 # it is put in the same directory as the .c file. When targetdir is not
456 # empty, path names will be stripped from the file names so that all files
457 # are in that dir and not in subdirectories.
458 %define rule_assemble_multi basenames=/A aflags=$(AFLAGS) targetdir= suffix=.s
461 TMP_TARGETS := $(addsuffix .o,%(basenames))
464 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
465 TMP_WILDCARD := %(targetdir)/%
467 # Be sure that all .s files are generated
468 $(TMP_TARGETS) : | $(addsuffix %(suffix),%(basenames))
470 # Be sure that all .c files are found
471 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
473 vpath %%(suffix) $(TMP_DIRS)
478 $(TMP_TARGETS) : AFLAGS := %(aflags)
479 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %%(suffix)
480 %assemble_q opt=$(AFLAGS)
482 #------------------------------------------------------------------------------
485 #------------------------------------------------------------------------------
486 # Link %(objs) to %(prog) using the libraries in %(uselibs)
487 %define rule_link_prog prog=/A objs=/A ldflags=$(LDFLAGS) uselibs= \
488 usehostlibs= usestartup=yes detach=no nix=no
492 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
494 ifeq (%(usestartup),no)
495 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
498 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
500 %(prog) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
502 %(prog) : %(objs) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
503 %link_q from="%(objs)" opt="%(ldflags) $(EXTRA_LDFLAGS)" \
504 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
506 #------------------------------------------------------------------------------
509 #------------------------------------------------------------------------------
510 # Link %(progs) from object in %(objdir) to executables in %(targetdir) using
511 # the AROS libraries in %(uselibs) and the host libraries in %(usehostlibs)
512 %define rule_link_progs progs=/A targetdir=$(AROSDIR)/$(CURDIR) \
513 objdir=$(GENDIR)/$(CURDIR) ldflags=$(LDFLAGS) uselibs= usehostlibs= \
514 usestartup=yes detach=no
518 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
520 ifeq (%(usestartup),no)
521 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
524 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
526 $(addprefix %(targetdir)/,%(progs)) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
528 $(addprefix %(targetdir)/,%(progs)) : %(targetdir)/% : %(objdir)/%.o \
529 $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
530 %link_q from=$< opt="%(ldflags) $(EXTRA_LDFLAGS)" \
531 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
533 #------------------------------------------------------------------------------
536 #------------------------------------------------------------------------------
537 # Link the %(objs) to the library %(libdir)/lib%(libname).a in
538 %define rule_link_linklib libname=/A objs=/A libdir=$(LIBDIR)
540 %(libdir)/lib%(libname).a : %(objs)
543 #------------------------------------------------------------------------------
546 #------------------------------------------------------------------------------
547 # Link the %(objs) to the library %(libdir)/lib%(libname).so in
548 %define rule_link_shlib libname=/A objs=/A libdir=$(LIBDIR)
550 %(libdir)/lib%(libname).so : %(objs)
551 @$(SHARED_LD) $(SHARED_LDFLAGS) -o $@ $^
553 #------------------------------------------------------------------------------
556 #------------------------------------------------------------------------------
557 # Link the %(objs) and %(endobj) to %(module) with errors in %(err) and using
558 # the libraries in %(uselibs) and the host libraries in %(usehostlibs)
559 %define rule_linkmodule module=/A objs=/A endobj=/A err=/A objdir=$(OBJDIR) \
560 uselibs= usehostlibs=
562 %(module) : OBJS := %(objs)
563 %(module) : ENDTAG := %(endobj)
564 %(module) : ERR := %(err)
565 %(module) : OBJDIR := %(objdir)
566 %(module) : LIBS := $(addprefix -l,%(uselibs)) -lautoinit -llibinit -L/usr/lib $(addprefix -l,%(usehostlibs))
567 %(module) : %(objs) %(endobj) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
568 %link_module_q err=$(ERR) endtag=$(ENDTAG) objs=$(OBJS) libs=$(LIBS) objdir=$(OBJDIR)
571 #------------------------------------------------------------------------------
574 #------------------------------------------------------------------------------
575 # Generate a rule to generate a function reference file from a C source file.
576 # Basename may contain a directory part, then the source file has to be in that
577 # directory. The generated file will be put in the object directory without the
580 # - basename: the basename of the file to compile. Use % for a wildcard rule
581 # - cflags (default $(CFLAGS)): the C flags to use for compilation
582 # - targetdir: the directory to put the generated .ref file. By default the
583 # .ref file will be put in the same directory as the .c file.
584 # - includefile: This file will be included at the head of the source file
585 %define rule_ref basename=/A cflags=$(CFLAGS) targetdir= includefile= compiler=target
588 GENFILE_TMP := %(basename).ref
590 GENFILE_TMP := %(targetdir)/$(notdir %(basename)).ref
593 ifeq ($(filter %(compiler),target host),)
594 $(error use of %rule_ref: compiler has to be 'host' or 'target')
597 ifeq (%(compiler),target)
598 $(GENFILE_TMP) : CC:=$(TARGET_CC)
600 $(GENFILE_TMP) : CC:=$(HOST_CC)
603 $(GENFILE_TMP) : %(basename).c $(CXREF) %(includefile)
604 ifeq (%(includefile),)
605 %mkref_q cc=$(CC) cflags="%(cflags)"
607 %mkref_q cc=$(CC) cflags="%(cflags) -include %(includefile)"
611 #------------------------------------------------------------------------------
614 #------------------------------------------------------------------------------
615 # Generate a rule to generate a function reference file from a C source file.
616 # Basename may contain a directory part, then the source file has to be in that
617 # directory. The generated file will be put in the object directory without the
620 # - basenames: the basenames of the files to compile. No wildcard is allowed
621 # - cflags (default $(CFLAGS)): the C flags to use for compilation
622 # - targetdir: the directory to put the generated .ref file. By default the
623 # .ref file will be put in the same directory as the .c file. When targetdir
624 # is not empty all files will be put there and path parts in the basenames
625 # will be stripped off.
626 # - includefile: This file will be included at the head of the source file
627 %define rule_ref_multi basenames=/A cflags=$(CFLAGS) targetdir= includefile= \
631 TMP_TARGETS := $(addsuffix .ref,%(basenames))
632 TMP_WILDCARD := %.ref
634 TMP_TARGETS := $(addprefix %(targetdir)/,$(addsuffix .ref,$(notdir %(basenames))))
635 TMP_WILDCARD := %(targetdir)/%.ref
637 # Be sure that all .c files are generated
638 $(TMP_TARGETS) : | $(addsuffix .c,%(basenames))
640 # Be sure that all .c files are found
641 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
643 vpath %.c $(TMP_DIRS)
648 ifeq ($(filter %(compiler),target host),)
649 $(error use of %rule_ref: compiler has to be 'host' or 'target')
652 ifeq (%(compiler),target)
653 $(TMP_TARGETS) : CC:=$(TARGET_CC)
655 $(TMP_TARGETS) : CC:=$(HOST_CC)
657 ifeq (%(includefile),)
658 $(TMP_TARGETS) : CFLAGS:=%(cflags)
660 $(TMP_TARGETS) : CFLAGS:="%(cflags) -include %(includefile)"
661 $(TMP_TARGETS) : %(includefile)
663 $(TMP_TARGETS) : $(CXREF)
664 $(TMP_TARGETS) : $(TMP_WILDCARD) : %.c
667 #------------------------------------------------------------------------------
670 #------------------------------------------------------------------------------
671 # Generate the libdefs.h include file for a module.
672 %define rule_genmodule_genlibdefs modname=/A modtype=/A modsuffix= conffile= targetdir=
674 TMP_TARGET := %(modname)_libdefs.h
675 TMP_DEPS := $(GENMODULE)
678 TMP_OPTS += -c %(conffile)
679 TMP_DEPS += %(conffile)
681 TMP_DEPS += %(modname).conf
683 ifneq (%(modsuffix),)
684 TMP_OPTS += -s %(modsuffix)
686 ifneq (%(targetdir),)
687 TMP_OPTS += -d %(targetdir)
688 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
691 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
692 $(TMP_TARGET) : MODNAME := %(modname)
693 $(TMP_TARGET) : MODTYPE := %(modtype)
694 $(TMP_TARGET) : $(TMP_DEPS)
695 @$(ECHO) "Generating $(notdir $@)"
696 @$(GENMODULE) $(OPTS) writelibdefs $(MODNAME) $(MODTYPE)
698 #------------------------------------------------------------------------------
701 #------------------------------------------------------------------------------
702 # Generate the libdefs.h include file for a module.
703 %define rule_genmodule_funclist \
704 modname=/A modtype=/A modsuffix= conffile= targetdir= reffile=
706 TMP_TARGET := %(modname).funclist
707 TMP_DEPS := $(GENMODULE)
710 $(error reffile needed in rule_genmodule_funclist but none specified)
712 TMP_OPTS := -r %(reffile)
713 TMP_DEPS += %(reffile)
715 TMP_OPTS += -c %(conffile)
716 TMP_DEPS += %(conffile)
718 TMP_DEPS += %(modname).conf
720 ifneq (%(modsuffix),)
721 TMP_OPTS += -s %(modsuffix)
723 ifneq (%(targetdir),)
724 TMP_OPTS += -d %(targetdir)
725 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
728 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
729 $(TMP_TARGET) : MODNAME := %(modname)
730 $(TMP_TARGET) : MODTYPE := %(modtype)
731 $(TMP_TARGET) : $(TMP_DEPS)
732 @$(ECHO) "Generating $(notdir $@)"
733 @$(GENMODULE) $(OPTS) writefunclist $(MODNAME) $(MODTYPE)
735 #------------------------------------------------------------------------------
738 #------------------------------------------------------------------------------
739 # Generate a Makefile.%(modname) with the genmodule program and include this
740 # generated file in this Makefile
741 %define rule_genmodule_makefile modname=/A modtype=/A modsuffix= conffile= \
744 TMP_TARGET := Makefile.%(modname)
745 TMP_DEPS := $(GENMODULE)
748 TMP_OPTS += -c %(conffile)
749 TMP_DEPS += %(conffile)
751 TMP_DEPS += %(modname).conf
753 ifneq (%(modsuffix),)
754 TMP_OPTS += -s %(modsuffix)
756 ifneq (%(targetdir),)
757 TMP_OPTS += -d %(targetdir)
758 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
761 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
762 $(TMP_TARGET) : MODNAME := %(modname)
763 $(TMP_TARGET) : MODTYPE := %(modtype)
764 $(TMP_TARGET) : $(TMP_DEPS)
765 @$(GENMODULE) $(OPTS) writemakefile $(MODNAME) $(MODTYPE)
767 #------------------------------------------------------------------------------
769 #------------------------------------------------------------------------------
770 # Generate dummy support files so cxref when used on the a module source file
771 # will find something to include. This rule has to be preceeded by
772 # %rule_genmodule_makefile
773 %define rule_genmodule_dummy modname=/A modtype=/A modsuffix= conffile= targetdir=
775 ifneq ($(%(modname)_INCLUDES),)
776 TMP_TARGETS := $(%(modname)_INCLUDES)
778 TMP_DEPS := $(GENMODULE)
781 TMP_OPTS += -c %(conffile)
782 TMP_DEPS += %(conffile)
784 TMP_DEPS += %(modname).conf
786 ifneq (%(modsuffix),)
787 TMP_OPTS += -s %(modsuffix)
789 ifneq (%(targetdir),)
790 TMP_OPTS += -d %(targetdir)
791 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
794 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
795 $(TMP_TARGETS) : MODNAME := %(modname)
796 $(TMP_TARGETS) : MODTYPE := %(modtype)
797 $(TMP_TARGETS) : $(TMP_DEPS)
798 @$(ECHO) "Generating dummy include files"
799 @$(GENMODULE) $(OPTS) writedummy $(MODNAME) $(MODTYPE)
802 #------------------------------------------------------------------------------
805 #------------------------------------------------------------------------------
806 # Generate the support files for compiling a module. This includes include
807 # files and source files. This rule has to be preceeded by
808 # %rule_genmodule_makefile
809 %define rule_genmodule_files modname=/A modtype=/A modsuffix= targetdir= \
812 TMP_TARGETS := $(%(modname)_STARTFILES) $(%(modname)_ENDFILES) \
813 $(%(modname)_LINKLIBFILES)
814 TMP_TARGETS := $(addsuffix .c,$(TMP_TARGETS)) $(addsuffix .S, $(%(modname)_LINKLIBAFILES))
816 TMP_DEPS := $(GENMODULE)
817 ifeq ($(%(modname)_NEEDREF), yes)
819 $(error reffile needed in rule_genmodule_files but none specified)
821 TMP_OPTS := -r %(reffile)
822 TMP_DEPS += %(reffile)
827 TMP_OPTS += -c %(conffile)
828 TMP_DEPS += %(conffile)
830 TMP_DEPS += %(modname).conf
832 ifneq (%(modsuffix),)
833 TMP_OPTS += -s %(modsuffix)
835 ifneq (%(targetdir),)
836 TMP_OPTS += -d %(targetdir)
837 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
840 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
841 $(TMP_TARGETS) : MODNAME := %(modname)
842 $(TMP_TARGETS) : MODTYPE := %(modtype)
843 $(TMP_TARGETS) : $(TMP_DEPS)
844 @$(ECHO) "Generating functable and support files for module $(BD_MODNAME$(BDID))"
845 ifneq (%(conffile),lib.conf)
846 @$(IF) $(TEST) -f lib.conf; then \
847 $(ECHO) "WARNING !!! $(CURDIR)/lib.conf may probably be removed"; \
850 @$(IF) $(TEST) -f libdefs.h; then \
851 $(ECHO) "WARNING !!! $(CURDIR)/libdefs.h may probably be removed"; \
853 @$(GENMODULE) $(OPTS) writefiles $(MODNAME) $(MODTYPE)
855 #------------------------------------------------------------------------------
857 #------------------------------------------------------------------------------
858 # Generate the support files for compiling a module. This includes include
859 # files and source files.
860 %define rule_genmodule_includes modname=/A modtype=/A modsuffix= \
861 targetdir= conffile= reffile=
864 ifneq ($(%(modname)_INCLUDES),)
865 TMP_TARGETS := $(%(modname)_INCLUDES)
867 TMP_DEPS := $(GENMODULE)
868 ifeq ($(%(modname)_NEEDREF), yes)
870 $(error reffile needed in rule_genmodule_files but none specified)
872 TMP_OPTS := -r %(reffile)
873 TMP_DEPS += %(reffile)
878 TMP_OPTS += -c %(conffile)
879 TMP_DEPS += %(conffile)
881 TMP_DEPS += %(modname).conf
883 ifneq (%(modsuffix),)
884 TMP_OPTS += -s %(modsuffix)
886 ifneq (%(targetdir),)
887 TMP_OPTS += -d %(targetdir)
888 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
891 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
892 $(TMP_TARGETS) : MODNAME := %(modname)
893 $(TMP_TARGETS) : MODTYPE := %(modtype)
894 $(TMP_TARGETS) : $(TMP_DEPS)
895 @$(ECHO) "Generating include files"
896 @$(GENMODULE) $(OPTS) writeincludes $(MODNAME) $(MODTYPE)
899 #------------------------------------------------------------------------------
901 #------------------------------------------------------------------------------
902 # Common rules for all makefiles
904 # Delete generated makefiles
907 @$(RM) $(TOP)/$(CURDIR)/mmakefile $(TOP)/$(CURDIR)/mmakefile.bak
909 include $(TOP)/config/make.tail
911 BDID := $(BDTARGETID)
913 #------------------------------------------------------------------------------
916 #############################################################################
917 #############################################################################
919 ## Here are the mmakefile build macro's. These are macro's that takes care ##
920 ## of everything to go from the sources to the generated target. Also all ##
921 ## intermediate files and directories that are needed are created by these ##
924 #############################################################################
925 #############################################################################
927 #------------------------------------------------------------------------------
929 %define build_prog mmake=/A progname=/A files=$(BD_PROGNAME$(BDID)) asmfiles= \
930 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
931 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
932 aflags=$(AFLAGS) uselibs= usehostlibs= usestartup=yes detach=no nix=no
936 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
938 BD_PROGNAME$(BDID) := %(progname)
939 BD_OBJDIR$(BDID) := %(objdir)
940 BD_TARGETDIR$(BDID) := %(targetdir)
942 BD_FILES$(BDID) := %(files)
943 BD_ASMFILES$(BDID) := %(asmfiles)
944 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID)) $(BD_ASMFILES$(BDID))))
945 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
947 BD_CFLAGS$(BDID) := %(cflags)
948 BD_AFLAGS$(BDID) := %(aflags)
949 BD_DFLAGS$(BDID) := %(dflags)
950 BD_LDFLAGS$(BDID) := %(ldflags)
953 %(mmake)-quick : %(mmake)
955 #MM %(mmake) : includes-generate-deps
956 %(mmake) : $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID))
958 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
959 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
960 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
961 %rule_assemble_multi basenames=$(BD_ASMFILES$(BDID)) targetdir=$(BD_OBJDIR$(BDID)) \
962 aflags=$(BD_AFLAGS$(BDID))
964 %rule_link_prog prog=$(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) \
965 objs=$(BD_OBJS$(BDID)) ldflags=$(BD_LDFLAGS$(BDID)) \
966 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
967 usestartup="%(usestartup)" detach="%(detach)" nix="%(nix)"
971 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
973 $(BD_OBJS$(BDID)) $(BD_DEPS$(BDID)) : | $(BD_OBJDIR$(BDID))
974 $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) : | $(BD_TARGETDIR$(BDID))
975 GLOB_MKDIRS += $(BD_OBJDIR$(BDID)) $(BD_TARGETDIR$(BDID))
978 #------------------------------------------------------------------------------
981 #------------------------------------------------------------------------------
982 # Build programs, for every C file an executable will be built with the same
984 %define build_progs mmake=/A files=/A \
985 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
986 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
987 uselibs= usehostlibs= usestartup=yes detach=no
991 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
993 BD_OBJDIR$(BDID) := %(objdir)
994 BD_TARGETDIR$(BDID) := %(targetdir)
996 BD_FILES$(BDID) := %(files)
997 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
998 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
999 BD_EXES$(BDID) := $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID)))
1001 BD_CFLAGS$(BDID) := %(cflags)
1002 ifneq ($(strip $(filter arosc_shared,%(uselibs))),)
1003 BD_CFLAGS$(BDID) += -D_CLIB_LIBRARY_ -I$(TOP)/rom/exec
1005 BD_DFLAGS$(BDID) := %(dflags)
1006 BD_LDFLAGS$(BDID) := %(ldflags)
1009 %(mmake)-quick : %(mmake)
1011 #MM %(mmake) : includes-generate-deps
1012 %(mmake) : $(BD_EXES$(BDID))
1014 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
1015 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
1016 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
1018 %rule_link_progs progs=$(BD_FILES$(BDID)) \
1019 targetdir=$(BD_TARGETDIR$(BDID)) objdir=$(BD_OBJDIR$(BDID)) \
1020 ldflags=$(BD_LDFLAGS$(BDID)) \
1021 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
1022 usestartup="%(usestartup)" detach="%(detach)"
1026 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
1028 $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID))) : | $(BD_TARGETDIR$(BDID))
1029 $(BD_DEPS$(BDID)) $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1030 GLOB_MKDIRS += $(BD_TARGETDIR$(BDID)) $(BD_OBJDIR$(BDID))
1033 #------------------------------------------------------------------------------
1036 #------------------------------------------------------------------------------
1038 # This is a bare version: It just compiles and links the given files. It is
1039 # assumed that all needed boiler plate code is in the files. This should only
1040 # be used for compiling external code. For AROS code use %build_module
1041 %define build_module_simple mmake=/A modname=/A modtype=/A \
1042 files="$(basename $(wildcard *.c))" \
1043 cflags=$(CFLAGS) dflags=$(BD_DEFDFLASGS) \
1044 objdir=$(OBJDIR) moduledir= \
1045 uselibs= usehostlibs= compiler=target
1047 # Define metamake targets and their dependencies
1048 #MM %(mmake) : core-linklibs includes-generate-deps
1049 #MM %(mmake)-kobj : core-linklibs includes-generate-deps
1053 BD_ALLTARGETS := %(mmake) %(mmake)-clean %(mmake)-quick %(mmake)-kobj
1055 .PHONY : $(BD_ALLTARGETS)
1058 $(error using %build_module_simple: modname may not be empty)
1061 $(error using %build_module_simple: $(MODTYPE) has to be defined with the type of the module)
1064 # Default values for variables and arguments
1065 BD_DEFLINKLIBNAME := %(modname)
1066 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1067 BD_DEFDFLAGS := %(cflags)
1068 OBJDIR ?= $(GENDIR)/$(CURDIR)
1069 BD_MODDIR := %(moduledir)
1070 ifeq ($(BD_MODDIR),)
1071 ifeq (%(modtype),library)
1072 BD_MODDIR := $(AROS_LIBS)
1074 ifeq (%(modtype),gadget)
1075 BD_MODDIR := $(AROS_GADGETS)
1077 ifeq (%(modtype),datatype)
1078 BD_MODDIR := $(AROS_DATATYPES)
1080 ifeq (%(modtype),handler)
1081 BD_MODDIR := $(AROS_FS)
1083 ifeq (%(modtype),device)
1084 BD_MODDIR := $(AROS_DEVS)
1086 ifeq (%(modtype),resource)
1087 BD_MODDIR := $(AROS_RESOURCES)
1089 ifeq (%(modtype),mui)
1090 BD_MODDIR := $(AROS_CLASSES)/Zune
1092 ifeq (%(modtype),mcc)
1093 BD_MODDIR := $(AROS_CLASSES)/Zune
1095 ifeq (%(modtype),mcp)
1096 BD_MODDIR := $(AROS_CLASSES)/Zune
1098 ifeq (%(modtype),hidd)
1099 BD_MODDIR := $(AROS_DRIVERS)
1102 ifeq ($(BD_MODDIR),)
1103 $(error Don't where to put the file for modtype %(modtype). Specify moduledir=)
1106 %rule_compile_multi \
1107 basenames="%(files)" targetdir="%(objdir)" \
1108 cflags="%(cflags)" dflags="%(dflags)" \
1109 compiler=%(compiler)
1111 BD_MODULE := $(BD_MODDIR)/%(modname).%(modtype)
1112 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1114 %(mmake)-quick : %(mmake)
1115 %(mmake) : $(BD_MODULE)
1116 %(mmake)-kobj : $(BD_KOBJ)
1118 # The module is linked from all the compiled .o files
1119 BD_OBJS := $(addprefix %(objdir)/, $(addsuffix .o,%(files)))
1120 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1121 endobj= err=%(modname).err objdir=%(objdir) \
1122 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1124 # Link kernel object file
1125 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1127 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1128 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1129 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1130 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1131 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1132 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1133 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1134 @$(ECHO) "Linking $@"
1135 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1136 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1139 ## Dependency fine-tuning
1141 BD_DEPS := $(addprefix %(objdir), $(addsuffix .o,%(files)))
1142 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1144 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1145 $(BD_MODULE) : | $(BD_MODDIR)
1146 $(BD_KOBJ) : | $(KOBJSDIR)
1147 GLOB_MKDIRS += %(objdir) $(BD_MODDIR) $(KOBJSDIR)
1149 %(mmake)-clean : FILES := $(BD_OBJS) $(BD_MODULE) $(BD_KOBJ) $(BD_DEPS)
1151 @$(ECHO) "Cleaning up for module %(modname)"
1152 @$(RM) $(BD_OBJS) $(BD_KOBJ)
1156 #------------------------------------------------------------------------------
1158 # Explanation of this macro is done in the developer's manual
1159 %define build_module mmake=/A modname=/A modtype=/A modsuffix= \
1160 conffile= files="$(basename $(wildcard *.c))" \
1161 linklibfiles= cflags=$(CFLAGS) dflags=$(BD_DEFDFLAGS) \
1162 objdir=$(OBJDIR) moduledir=$(BD_DEFMODDIR) prefix=$(AROSDIR) \
1163 reffile=$(BD_DEFREFFILE) noref= \
1164 linklibname=$(BD_DEFLINKLIBNAME) uselibs= usehostlibs= \
1165 compiler=target genincludes=
1167 # Define metamake targets and their dependencies
1168 #MM- includes-all : %(mmake)-includes
1169 #MM %(mmake) : %(mmake)-includes core-linklibs
1170 #MM %(mmake)-kobj : %(mmake)-includes core-linklibs
1171 #MM %(mmake)-linklib : %(mmake)-includes
1172 #MM %(mmake)-quick : %(mmake)-includes-quick
1173 #MM %(mmake)-includes : %(mmake)-makefile %(mmake)-includes-dirs \
1174 #MM includes-generate-deps
1175 #MM %(mmake)-includes-quick
1176 #MM %(mmake)-includes-dirs
1177 #MM %(mmake)-makefile
1178 #MM %(mmake)-funclist
1181 # All MetaMake targets defined by this macro
1182 BD_ALLTARGETS := %(mmake) %(mmake)-quick %(mmake)-includes \
1183 %(mmake)-includes-quick %(mmake)-includes-dirs %(mmake)-clean \
1184 %(mmake)-kobj %(mmake)-funclist %(mmake)-linklib
1186 .PHONY : $(BD_ALLTARGETS) %(mmake)-makefile
1189 $(error using %build_module: modname may not be empty)
1192 $(error using %build_module: $(MODTYPE) has to be defined with the type of the module)
1195 # Default values for variables and arguments
1196 BD_DEFLINKLIBNAME := %(modname)
1197 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1198 BD_DEFDFLAGS := %(cflags)
1199 OBJDIR ?= $(GENDIR)/$(CURDIR)
1201 ## Create genmodule include Makefile for the module
1203 %(mmake)-makefile : %(objdir)/Makefile.%(modname)
1205 %rule_genmodule_makefile \
1206 modname=%(modname) modtype=%(modtype) \
1207 modsuffix=%(modsuffix) targetdir=%(objdir) \
1208 conffile=%(conffile)
1210 %(objdir)/Makefile.%(modname) : | %(objdir)
1212 GLOB_MKDIRS += %(objdir)
1214 # Do not parse these statements if metatarget is not appropriate
1215 ifneq ($(filter $(TARGET),$(BD_ALLTARGETS)),)
1217 include %(objdir)/Makefile.%(modname)
1219 BD_DEFMODDIR := $(%(modname)_MODDIR)
1222 ## include files generation
1224 BD_INCDIR := %(prefix)/$(AROS_DIR_INCLUDE)
1225 ifeq (%(genincludes),yes)
1226 %(modname)_INCLUDES := proto/%(modname).h clib/%(modname)_protos.h defines/%(modname).h
1228 ifeq (%(genincludes),no)
1229 %(modname)_INCLUDES :=
1231 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1232 BD_DEFLIBDEFSINC := %(objdir)/%(modname)_deflibdefs.h
1234 %(mmake)-includes-quick : %(mmake)-includes
1235 %(mmake)-includes : $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1236 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1237 $(BD_LIBDEFSINC) $(BD_DEFLIBDEFSINC)
1239 ifneq ($(%(modname)_INCLUDES),)
1240 %rule_genmodule_includes modname=%(modname) modtype=%(modtype) \
1241 modsuffix=%(modsuffix) targetdir=%(objdir)/include \
1242 conffile=%(conffile) reffile=%(reffile)
1244 %rule_copy_diff_multi \
1245 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(GENINCDIR) \
1246 stampfile=%(objdir)/%(modname)_geninc
1248 %rule_copy_diff_multi \
1249 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(BD_INCDIR) \
1250 stampfile=%(objdir)/%(modname)_incs
1252 %rule_genmodule_dummy modname=%(modname) modtype=%(modtype) \
1253 modsuffix=%(modsuffix) \
1254 targetdir=%(objdir)/dummyinc conffile=%(conffile)
1256 BD_INCDIRS := $(filter-out ./,$(sort $(dir $(%(modname)_INCLUDES))))
1258 TMP%(modname)_INCDIRS := \
1259 %(objdir)/include $(addprefix %(objdir)/include/,$(BD_INCDIRS)) \
1260 $(GENINCDIR) $(addprefix $(GENINCDIR)/,$(BD_INCDIRS)) \
1261 $(BD_INCDIR) $(addprefix $(BD_INCDIR)/,$(BD_INCDIRS))
1262 %rule_makedirs dirs=$(TMP%(modname)_INCDIRS) setuptarget=%(mmake)-includes-dirs
1264 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES)) : | %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1265 GLOB_MKDIRS += %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1269 %rule_genmodule_genlibdefs modname=%(modname) modtype=%(modtype) \
1270 modsuffix=%(modsuffix) targetdir=%(objdir) \
1271 conffile=%(conffile)
1273 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1275 %(objdir)/%(modname)_deflibdefs.h : FILENAME := $(BD_LIBDEFSINC)
1276 %(objdir)/%(modname)_deflibdefs.h :
1277 @$(ECHO) "generating $@"
1278 @$(ECHO) "#define LC_LIBDEFS_FILE \"$(FILENAME)\"" >$@
1281 ## Generation of the funclist file
1283 %(mmake)-funclist : %(modname).funclist
1285 %rule_genmodule_funclist \
1286 modname=%(modname) modtype=%(modtype) modsuffix=%(modsuffix) \
1287 conffile=%(conffile) reffile=%(reffile)
1290 ## Extra genmodule src files generation
1292 %rule_genmodule_files modname=%(modname) modtype=%(modtype) \
1293 modsuffix=%(modsuffix) targetdir=%(objdir) \
1294 conffile=%(conffile) reffile=%(reffile)
1298 BD_FILES := %(files)
1299 BD_STARTFILES := $(addprefix %(objdir)/,$(%(modname)_STARTFILES))
1300 BD_ENDFILES := $(addprefix %(objdir)/,$(%(modname)_ENDFILES))
1302 BD_ARCHOBJS := $(wildcard %(objdir)/arch/*.o)
1303 BD_ARCHFILES := $(basename $(notdir $(BD_ARCHOBJS)))
1304 BD_NARCHFILES := $(filter-out $(BD_ARCHFILES),$(BD_FILES))
1306 BD_CFLAGS := %(cflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1307 BD_DFLAGS := %(dflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1309 BD_LINKLIBCFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBFILES))
1310 BD_LINKLIBAFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBAFILES))
1311 ifeq ($(strip $(%(modname)_LINKLIBFILES) %(linklibfiles)),)
1314 BD_LINKLIB := %(prefix)/$(AROS_DIR_LIB)/lib%(linklibname).a
1316 BD_LINKLIBFILES := $(BD_LINKLIBCFILES) $(BD_LINKLIBAFILES)
1318 BD_CCFILES := $(BD_NARCHFILES) $(BD_STARTFILES) \
1319 $(BD_ENDFILES) $(BD_LINKLIBCFILES) %(linklibfiles)
1321 %rule_compile_multi \
1322 basenames=$(BD_CCFILES) targetdir=%(objdir) \
1323 cflags=$(BD_CFLAGS) dflags=$(BD_DFLAGS) \
1324 compiler=%(compiler)
1326 ifneq ($(BD_LINKLIBAFILES),)
1327 %rule_assemble_multi \
1328 basenames=$(BD_LINKLIBAFILES) targetdir=%(objdir) suffix=.S
1331 ## function reference files generation
1334 basenames=$(BD_FILES) targetdir=%(objdir) \
1335 cflags="-I$(dir $(GENMODULE))/genmod_inc -I%(objdir)/dummyinc $(strip $(BD_CFLAGS))" \
1336 compiler=%(compiler)
1339 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(BD_FILES))))
1341 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(filter-out %(noref),$(BD_FILES)))))
1344 %rule_join from=$(BD_REFS) to=%(reffile) \
1345 text="Collecting function references for module %(modname)"
1350 ifeq (%(modsuffix),)
1351 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modtype)
1352 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1354 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modsuffix)
1355 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modsuffix).o
1358 %(mmake)-quick : %(mmake)
1359 %(mmake) : $(BD_MODULE) $(BD_LINKLIB)
1360 %(mmake)-kobj : $(BD_KOBJ) $(BD_LINKLIB)
1361 %(mmake)-linklib : $(BD_LINKLIB)
1363 BD_OBJS := $(addsuffix .o,$(BD_STARTFILES)) $(BD_ARCHOBJS) \
1364 $(addsuffix .o, $(addprefix %(objdir)/,$(notdir $(BD_NARCHFILES))))
1365 BD_ENDOBJS := $(addsuffix .o,$(BD_ENDFILES))
1366 BD_LINKLIBOBJS:= $(addsuffix .o,$(addprefix %(objdir)/,$(notdir %(linklibfiles))) $(BD_LINKLIBFILES))
1368 # The module is linked from all the compiled .o files
1369 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1370 endobj=$(BD_ENDOBJS) err=%(modname).err objdir=%(objdir) \
1371 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1374 ifneq ($(BD_LINKLIB),)
1375 %rule_link_linklib libname=%(linklibname) objs=$(BD_LINKLIBOBJS) libdir=%(prefix)/$(AROS_DIR_LIB)
1377 $(BD_LINKLIB) : | %(prefix)/$(AROS_DIR_LIB)
1378 GLOB_MKDIRS += %(prefix)/$(AROS_DIR_LIB)
1381 # Link kernel object file
1382 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1384 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1385 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1386 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1387 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1388 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1389 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1390 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1391 @$(ECHO) "Linking $@"
1392 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1393 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1395 ## Dependency fine-tuning
1397 BD_DEPS := $(addsuffix .d,$(addprefix %(objdir)/,$(notdir $(BD_CCFILES))))
1398 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1400 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1401 $(BD_MODULE) : | %(prefix)/%(moduledir)
1402 $(BD_KOBJ) : | $(KOBJSDIR)
1403 GLOB_MKDIRS += %(objdir) %(prefix)/%(moduledir) $(KOBJSDIR)
1405 # Some include files need to be generated before the .c can be parsed.
1406 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-includes %(mmake)-quick %(mmake)-kobj),) # Only for this target these deps are wanted
1407 BD_REFFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1408 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES))
1409 $(BD_REFS) : $(BD_REFFILE_DEPS) $(dir $(GENMODULE))/genmod_inc/aros/libcall.h
1411 BD_DFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1412 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES))
1413 $(BD_DEPS) : $(BD_DFILE_DEPS)
1416 BD_TOCLEAN := $(BD_OBJS) $(BD_DEPS) %(reffile) \
1417 $(BD_REFS) $(BD_MODULE) $(BD_LINKLIB) $(BD_KOBJ) \
1418 $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1419 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1420 $(addprefix .c,$(BD_LINKLIBFILES)) $(BD_LINKLIBOBJS) $(BD_LIBDEFSINC) \
1421 %(objdir)/%(modname)_deflibdefs.h \
1422 $(addsuffix .c,$(BD_STARTFILES) $(BD_ENDFILES)) \
1424 %(mmake)-clean : FILES := $(BD_TOCLEAN)
1426 @$(ECHO) "Cleaning up for module %(modname)"
1429 endif # $(TARGET) in $(BD_ALLTARGETS)
1431 #------------------------------------------------------------------------------
1434 #------------------------------------------------------------------------------
1436 # - mmake is the mmaketarget
1437 # - libname is the baselibname e.g. lib%(libname).a will be created
1438 # - files are the C source files to include in the lib. The list of files
1439 # has to be given without the .c suffix
1440 # - asmfiles are the asm files to include in the lib. The list of files has to
1441 # be given with the .s suffix
1442 # - cflags are the flags to compile the source (default $(CFLAGS))
1443 # - dflags are the flags use during makedepend (default equal to cflags)
1444 # - aflags are the flags use during assembling (default $(AFLAGS))
1445 # - objdir is where the .o are generated
1446 # - libdir is the directory where the linklib will be placed (default $(LIBDIR))
1447 %define build_linklib mmake=/A libname=/A files="$(basename $(wildcard *.c))" \
1448 asmfiles= cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) objdir=$(OBJDIR) libdir=$(LIBDIR)
1450 # assign and generate the local variables used in this macro
1451 OBJDIR ?= $(GENDIR)/$(CURDIR)
1453 BD_FILES := %(files)
1454 BD_ASMFILES := %(asmfiles)
1456 BD_ARCHOBJS := $(wildcard %(objdir)/arch/*.o)
1457 BD_ARCHFILES := $(basename $(notdir $(BD_ARCHOBJS)))
1458 BD_NARCHFILES := $(filter-out $(BD_ARCHFILES),$(BD_FILES))
1460 BD_OBJS := $(BD_ARCHOBJS) $(addsuffix .o,$(addprefix %(objdir)/,$(notdir $(BD_NARCHFILES) $(BD_ASMFILES))))
1461 BD_DEPS := $(patsubst %.o,%.d,$(BD_OBJS))
1463 BD_CFLAGS := %(cflags)
1465 BD_DFLAGS := $(BD_CFLAGS)
1467 BD_DFLAGS := %(dflags)
1469 BD_AFLAGS := %(aflags)
1471 BD_LINKLIB := %(libdir)/lib%(libname).a
1473 .PHONY : %(mmake) %(mmake)-clean
1475 #MM %(mmake) : includes-generate-deps
1476 %(mmake) : $(BD_LINKLIB)
1480 @$(RM) $(BD_OBJS) $(BD_DEPS)
1482 ifeq ($(TARGET),%(mmake))
1483 ifneq ($(dir $(BD_FILES)),./)
1484 vpath %.c $(filter-out ./,$(dir $(BD_FILES)))
1487 %rule_compile basename=% targetdir=%(objdir) \
1488 cflags=$(BD_CFLAGS) dflags=$(BD_DFLAGS)
1489 %rule_assemble basename=% targetdir=%(objdir) \
1493 %rule_link_linklib libname=%(libname) objs=$(BD_OBJS) libdir=%(libdir)
1495 %include_deps depstargets=%(mmake) deps=$(BD_DEPS)
1497 $(BD_OBJS) $(BD_DEPS) : | %(objdir)
1498 $(BD_LINKLIB) : | %(libdir)
1499 GLOB_MKDIRS += %(objdir) %(libdir)
1502 #------------------------------------------------------------------------------
1505 #------------------------------------------------------------------------------
1507 # - mmake is the mmaketarget
1508 # - catalogs is the list of catalogs, without the .ct suffix (default *.ct)
1509 # - description is the catalog description file (.cd) (default *.cd)
1510 # - subdir is the destination subdir of the catalogs
1511 # - name is the name of the destination catalog, without the .catalog suffix
1512 # - source is the path to the generated source code file
1513 # - dir is the base destination directory (default $(AROS_CATALOGS))
1514 # - sourcedescription is the path to the FlexCat's source description file, without the .sd suffix
1516 %define build_catalogs mmake=/A name=/A subdir=/A \
1517 catalogs="$(basename $(wildcard *.ct))" source="../strings.h" \
1518 description="$(basename $(wildcard *.cd))" dir=$(AROS_CATALOGS) \
1519 sourcedescription="$(TOOLDIR)/C_h_orig"
1521 %buildid targets="%(mmake) %(mmake)-clean"
1523 BD_SRCS$(BDID) := $(addsuffix .ct, %(catalogs))
1524 BD_OBJS$(BDID) := $(addsuffix /%(subdir)/%(name).catalog, $(addprefix %(dir)/, %(catalogs)))
1525 BD_DIRS$(BDID) := $(addsuffix /%(subdir), $(addprefix %(dir)/, %(catalogs)))
1528 %(mmake) : $(BD_OBJS$(BDID)) %(source)
1530 $(BD_OBJS$(BDID)) : | $(BD_DIRS$(BDID))
1531 GLOB_MKDIRS += $(BD_DIRS$(BDID))
1533 %(dir)/%/%(subdir)/%(name).catalog : %.ct %(description).cd
1534 @$(ECHO) "Creating %(name) catalog for language $*."
1535 @$(FLEXCAT) %(description).cd $*.ct CATALOG=%(dir)/$*/%(subdir)/%(name).catalog || [ $$? -lt 10 ]
1538 %(source) : %(description).cd
1539 @$(ECHO) "Creating %(name) catalog source file %(source)"
1540 @$(FLEXCAT) %(description).cd %(source)=%(sourcedescription).sd
1545 $(RM) $(BD_OBJS$(BDID)) %(source)
1547 .PHONY: %(mmake) %(mmake-clean)
1551 #-----------------------------------------------------------------------------
1553 #-----------------------------------------------------------------------------
1555 # - mmake is the mmaketarget
1556 # - icons is a list of icon base names (ie. without the .info suffix)
1557 # - dir is the destination directory
1558 #-----------------------------------------------------------------------------
1560 %define build_icons mmake=/A icons=/A dir=/A
1562 %buildid targets="%(mmake) %(mmake)-clean"
1564 BD_OBJS$(BDID) := $(addprefix %(dir)/, $(addsuffix .info,%(icons)))
1567 %(mmake) : $(BD_OBJS$(BDID))
1569 %(dir)/%.info : %.info.src %.png
1570 @$(ECHO) Creating $(notdir $@)...
1571 @$(ILBMTOICON) $+ $@
1573 $(BD_OBJS$(BDID)) : | %(dir)
1574 GLOB_MKDIRS += %(dir)
1578 @$(RM) $(BD_OBJS$(BDID))
1584 #-----------------------------------------------------------------------------
1586 #------------------------------------------------------------------------------
1587 # Compile files for an arch-specific replacement of code for a module
1588 # - files: the basenames of the C files to compile.
1589 # - asmfiles: the basenames of the asm files to assemble.
1590 # - mainmmake: the mmake of the module in the main directory to compile these
1591 # arch specific files for.
1592 # - maindir: the object directory for the main module
1593 # - arch: the arch for which to compile these files. It can have the form
1594 # of ARCH, CPU or ARCH-CPU, e.g. linux, i386 or linux-i386
1595 # - cflags (default $(CFLAGS)): the C flags to use for compilation
1596 # - dflags: the flags used during creation of dependency file. If not specified
1597 # the same value as cflags will be used
1598 # - aflags: the flags used during assembling
1599 # - compiler: (host or target) specifies which compiler to use. By default
1600 # the target compiler is used
1601 %define build_archspecific files= asmfiles= mainmmake=/A maindir=/A arch=/A \
1602 cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) compiler=target modulename=
1604 ifeq (%(files) %(asmfiles),)
1605 $(error no files or asmfiles given)
1608 %buildid targets="%(mainmmake)-%(arch)"
1610 #MM- %(mainmmake) : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1611 #MM- %(mainmmake)-linklib : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1612 #MM- %(mainmmake)-kobj : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1614 #MM %(mainmmake)-%(arch) : %(mainmmake)-includes
1617 $(error argument arch has to be non empty for the rule_compile_archspecific macro)
1620 BD_OBJDIR$(BDID) := $(GENDIR)/%(maindir)/arch
1621 BD_COBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1622 BD_ASMOBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(asmfiles))))
1623 BD_OBJS$(BDID) := $(BD_COBJS$(BDID)) $(BD_ASMOBJS$(BDID))
1624 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1626 ifeq ($(TARGET),%(mainmmake)-%(arch))
1627 vpath %.c $(filter-out ./,$(dir %(files)))
1628 vpath %.s $(filter-out ./,$(dir %(asmfiles)))
1629 vpath %.S $(filter-out ./,$(dir %(asmfiles)))
1632 $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1633 GLOB_MKDIRS += $(BD_OBJDIR$(BDID))
1636 %(mainmmake)-%(arch) :: $(BD_OBJS$(BDID))
1638 ifeq ($(findstring %(compiler),host target),)
1639 $(error unknown compiler %(compiler))
1641 ifeq (%(compiler),target)
1642 $(BD_COBJS$(BDID)) : TMP_CMD:=$(TARGET_CC)
1644 ifeq (%(compiler),host)
1645 $(BD_COBJS$(BDID)) : TMP_CMD:=$(HOST_CC)
1647 ifneq (%(modulename),)
1648 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags) -I$(GENDIR)/%(maindir) \
1649 --include $(GENDIR)/%(maindir)/%(modulename)_deflibdefs.h
1651 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags)
1653 ifeq ($(TARGET),%(mainmmake)-%(arch))
1654 $(BD_OBJDIR$(BDID))/%.o : %.c
1655 %compile_q opt=$(TMP_CFLAGS) cmd=$(TMP_CMD)
1659 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(cflags)
1661 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(dflags)
1663 ifeq ($(TARGET),%(mainmmake)-%(arch))
1664 $(BD_OBJDIR$(BDID))/%.d : %.c
1665 %mkdepend_q flags=$(TMP_DFLAGS)
1668 $(BD_ASMOBJS$(BDID)) : AFLAGS:=%(aflags)
1670 ifeq ($(TARGET),%(mainmmake)-%(arch))
1671 $(BD_OBJDIR$(BDID))/%.o : %.s
1672 %assemble_q opt=$(AFLAGS)
1673 $(BD_OBJDIR$(BDID))/%.o : %.S
1674 %assemble_q opt=$(AFLAGS)
1677 %include_deps depstargets=%(mainmmake)-%(arch) deps=$(BD_DEPS$(BDID))
1679 #------------------------------------------------------------------------------
1687 # ======================
1688 # Old stuff, will probably be removed in the future
1693 # GNU Make automatic variables
1695 # $< First dependency
1696 # $? All newer dependencies
1697 # $^ All dependencies
1698 # $* The stem (ie. target is dir/a.foo.b and the pattern is
1699 # a.%.b, then the stem is dir/foo)
1701 #------------------------------------------------------------------------------
1702 # rule to generate libdefs.h with archtool (options may go away!)
1703 %define libdefs_rule conffile=lib.conf genlibdefstool=$(ARCHTOOL) dest=libdefs.h
1704 %(dest) : %(conffile) %(genlibdefstool)
1705 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1706 @%(genlibdefstool) -c -o $@ %(conffile)
1710 #------------------------------------------------------------------------------
1711 # generate asm files from c files (for debugging purposes)
1714 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1715 @$(TARGET_CC) -S $(CFLAGS) $< -c -o $@
1718 #------------------------------------------------------------------------------
1719 # Convert two png images to an Amiga icon file based on the description
1720 # file %(from), with outputfile going to %(to).
1721 %define makeicon2 from=$< to=$@ img1="$(basename $(basename $<))_N.png" img2="$(basename $(basename $<))_S.png"
1722 @$(ECHO) "Creating icon %(to)..."
1723 @$(PNGTOPNM) %(img1) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon1.iff
1724 @$(PNGTOPNM) %(img2) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon2.iff
1725 @$(ILBMTOICON) %(from) $(GENDIR)/genicon1.iff $(GENDIR)/genicon2.iff %(to)
1728 #------------------------------------------------------------------------------
1729 # NOTE: The following are all part of Iain's build changes, please don't use
1730 # or change anything below this line until you know what you are doing. This
1731 # is so that I don't conflict with the semantics of any of the above macros.
1732 #------------------------------------------------------------------------------
1734 #------------------------------------------------------------------------------
1735 # Copy files from one directory to another.
1737 %define copy_files_q files=$(FILES) src=. dst=/A maketarget=files-copy
1739 SRC_FILES := $(addprefix %(src)/, %(files))
1740 DST_FILES := $(addprefix %(dst)/, %(files))
1742 %(maketarget) : setup $(DST_FILES)
1744 $(DST_FILES) : %(dst)/% : %(src)/%
1752 #----------------------------------------------------------------------------------
1753 # Copy a diretory recursively to another place, preserving the original
1754 # hierarchical structure
1756 # src: the source directory whose content will be copied
1757 # dst: the directory where to copy src's content. If not existing, it will be made.
1759 %define copy_dir_recursive mmake=/A src=$(TOP)/$(CURDIR) dst=/A
1761 %(mmake)_FILES := $(shell cd %(src); find . -path '*/CVS' -prune -o -path '*/.svn' -prune -o -name .cvsignore -prune -o -name mmakefile -prune -o -name mmakefile.src -prune -o -type f -print)
1762 %(mmake)_DIRS := $(sort $(dir $(%(mmake)_FILES)))
1764 define %(mmake)_mkdir
1769 define %(mmake)_copy
1770 $(3)/$(1): $(2)/$(1) | $(dir $(3)/$(1))
1777 %(mmake): | $(GENDIR)/$(CURDIR)
1778 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1779 $(ECHO) "all: $(addprefix \$$(DST)/,$(%(mmake)_FILES))" > $$m
1780 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1781 for d in $(%(mmake)_DIRS); do \
1782 $(ECHO) "\$$(DST)/$$d: ; $(MKDIR) \$$@" >> $$m; \
1784 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1785 for f in $(%(mmake)_FILES); do \
1786 $(ECHO) "\$$(DST)/$$f: \$$(SRC)/$$f | \$$(dir \$$(DST)/$$f); $(CP) \$$< \$$@" >> $$m; \
1788 for dst in %(dst); do \
1789 $(MAKE) -f $$m DST=$$dst SRC=%(src) all; \
1792 $(GENDIR)/$(CURDIR):
1797 #------------------------------------------------------------------------------
1798 # Copy include files into the includes directories. There are currently
1799 # two include directories. One for building AROS $(AROS_INCLUDES) and one
1800 # for building tools that need to run on the host system $(GENINCDIR). The
1801 # $(GENINCDIR) path must not contain any references to the C runtime
1802 # library header files.
1804 %define copy_includes mmake=includes-copy includes=$(INCLUDE_FILES) path=. \
1805 dir= compiler=target
1807 ifeq ($(findstring %(compiler),host target),)
1808 $(error %copy_includes: compiler argument (%(compiler)) has to be host or target)
1812 BD_INCL_FILES := $(subst %(dir),$(GENINCDIR)/%(path),%(includes))
1813 BD_INC_PATH := %(dir)/
1815 BD_INCL_FILES := $(addprefix $(GENINCDIR)/%(path)/,%(includes))
1819 $(BD_INCL_FILES) : $(GENINCDIR)/%(path)/% : $(BD_INC_PATH)%
1823 ifeq (%(compiler),target)
1826 BD_INCL_FILES2 := $(subst %(dir),$(AROS_INCLUDES)/%(path),%(includes))
1828 BD_INCL_FILES2 := $(addprefix $(AROS_INCLUDES)/%(path)/,%(includes))
1831 BD_INCL_FILES += $(BD_INCL_FILES2)
1833 $(BD_INCL_FILES2) : $(AROS_INCLUDES)/%(path)/% : $(BD_INC_PATH)%
1838 %(mmake) : $(BD_INCL_FILES)
1842 $(BD_INCL_FILES) : | $(dir $(BD_INCL_FILES))
1843 GLOB_MKDIRS += $(dir $(BD_INCL_FILES))
1847 %define make_hidd_stubs hidd=/A cflags=$(CFLAGS) dflags=$(CFLAGS) parenttarget=linklibs
1848 STUBS_SRC := $(addsuffix .c,$(STUBS))
1849 STUBS_MEM := $(addsuffix .o,$(STUBS))
1850 STUBS_OBJ := $(addprefix $(OBJDIR)/,$(STUBS_MEM))
1851 STUBS_DEP := $(addprefix $(OBJDIR)/,$(addsuffix .d,$(STUBS)))
1852 HIDD_LIB := $(AROS_LIB)/libhiddstubs.a
1854 #MM- linklibs : hidd-%(hidd)-stubs
1855 #MM- %(parenttarget): hidd-%(hidd)-stubs
1856 #MM hidd-%(hidd)-stubs : includes includes-copy
1857 hidd-%(hidd)-stubs : setup $(HIDD_LIB)($(STUBS_MEM))
1859 $(HIDD_LIB)($(STUBS_MEM)) : $(STUBS_OBJ)
1862 $(STUBS_OBJ) : $(STUBS_SRC)
1863 %compile_q cmd=$(TARGET_CC) opt=%(cflags)
1865 $(STUBS_DEP) : $(STUBS_SRC)
1866 %mkdepend_q flags=%(dflags)
1869 %mkdirs_q $(OBJDIR) $(LIBDIR)
1873 -@$(RM) $(HIDD_LIB) $(OBJDIR)
1875 DEPS := $(DEPS) $(STUBS_DEP)
1879 #------------------------------------------------------------------------------
1880 # Build an imported source tree which uses the configure script from the
1881 # autoconf package. This rule will try to "integrate" the produced files as
1882 # much as possible in the AROS build, for example by putting libraries in the
1883 # standard library directory, includes in the standard include directory, and
1884 # so on. You can however override this behaviour.
1886 # As a special "bonus" for you, the PROGDIR environment variable is defined to
1887 # be %(bindir) (or its deduced value) when running "make install", and
1888 # "PROGDIR:" when running "make" alone; you can use this feature to pass the
1889 # configure script some more parameters whose value depends upon the PROGDIR
1890 # env var, so that the program gets all its stuff installed in the proper place
1891 # when building it, but when running it from inside AROS it can also find that
1892 # stuff by simply opening PROGDIR:, which it will do automatically if it uses
1893 # the configuration parameters set when running ./configure
1895 # *NOTICE*: DO NOT put a trailing '/' (slash) after $PROGDIR, as the variable
1896 # already contains either a '/' (slash) or a ':' (colon), thus simply attach it
1897 # to the name which has to follow it.
1900 %define build_with_configure mmake=/A srcdir=$(TOP)/$(CURDIR) prefix= \
1901 aros_prefix= extraoptions= nix_dir_layout= nix=no compiler=target \
1902 install_target=install postconfigure= postinstall=
1905 %(mmake)-prefix := %(prefix)
1907 %(mmake)-prefix := $(AROS_CONTRIB)
1910 ifneq (%(aros_prefix),)
1911 %(mmake)-aros_prefix := %(aros_prefix)
1913 %(mmake)-aros_prefix := $(%(mmake)-prefix)
1917 %(mmake)-nix := -nix
1918 %(mmake)-volpfx := /
1919 %(mmake)-volsfx := /
1921 ifeq (%(nix_dir_layout),)
1922 %(mmake)-nix_dir_layout := yes
1925 %(mmake)-volsfx := :
1927 ifeq (%(nix_dir_layout),)
1928 %(mmake)-nix_dir_layout := no
1932 %(mmake)-volfunc = $(%(mmake)-volpfx)$(notdir $1)$(%(mmake)-volsfx)
1934 %(mmake)-install_opts := prefix=$(%(mmake)-prefix) exec_prefix=$(%(mmake)-prefix)
1936 # Check if chosen compiler is valid
1937 ifeq ($(findstring %(compiler),host target kernel),)
1938 $(error unknown compiler %(compiler))
1941 # Set legacy 'host' variable based on chosen compiler
1942 ifeq (%(compiler),host)
1948 ifeq ($(filter yes, $(%(mmake)-nix_dir_layout) %(host)),yes)
1949 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)/bin
1950 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1953 %(mmake)-config_opts := --prefix=/PROGDIR --bindir=/PROGDIR --sbindir=/PROGDIR \
1954 --libdir=/LIB --includedir=/INCLUDE --oldincludedir=/INCLUDE
1956 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1959 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)
1961 %(mmake)-install_opts := bindir=$(%(mmake)-prefix) sbindir=$(%(mmake)-prefix) \
1962 libdir=$(AROS_LIB) includedir=$(AROS_INCLUDES) oldincludedir=$(AROS_INCLUDES)
1966 .PHONY : %(mmake) %(mmake)-clean %(mmake)-build_and_install-quick
1968 #MM- %(mmake) : setup includes linklibs-core %(mmake)-quick
1970 ifneq (%(install_target),)
1971 %(mmake)-install_command = \
1972 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1973 -C $(GENDIR)/$(CURDIR) %(install_target) && \
1974 $(TOUCH) $(GENDIR)/$(CURDIR)/.installed
1976 %(mmake)-uninstall_command = \
1977 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
1978 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1979 -C $(GENDIR)/$(CURDIR) uninstall
1981 %(mmake)-install_command := true
1982 %(mmake)-uninstall_command := true
1985 #MM- %(mmake)-quick : %(mmake)-configure %(postconfigure) %(mmake)-build_and_install-quick %(postinstall)
1988 %(mmake)-build_and_install-quick : $(GENDIR)/$(CURDIR)/.configured
1989 if ! $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -q -C $(GENDIR)/$(CURDIR); then \
1990 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
1991 $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -C $(GENDIR)/$(CURDIR) && \
1992 $(%(mmake)-install_command); \
1995 %(srcdir)/.files-touched:
1996 find %(srcdir) -exec $(TOUCH) -r %(srcdir)/configure '{}' \; && \
2000 %(mmake)-uninstall :
2001 $(%(mmake)-uninstall_command)
2003 ifneq ($(DEBUG),yes)
2004 %(mmake)-s_flag = -s
2008 %(mmake)-configure : $(GENDIR)/$(CURDIR)/.configured
2010 ifeq (%(compiler),host)
2011 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2013 %mkdirs_q $(GENDIR)/$(CURDIR)
2014 cd $(GENDIR)/$(CURDIR) && \
2015 find . -name config.cache -exec $(RM) '{}' \; && \
2017 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) && \
2020 ifeq (%(compiler),target)
2021 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2023 %mkdirs_q $(GENDIR)/$(CURDIR)
2024 cd $(GENDIR)/$(CURDIR) && \
2025 find . -name config.cache -exec $(RM) '{}' \; && \
2026 CC="$(TARGET_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2027 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2028 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2029 --host=$(AROS_TARGET_CPU)-aros \
2030 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2031 --without-x --without-pic --disable-shared && \
2034 ifeq (%(compiler),kernel)
2035 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2037 %mkdirs_q $(GENDIR)/$(CURDIR)
2038 cd $(GENDIR)/$(CURDIR) && \
2039 find . -name config.cache -exec $(RM) '{}' \; && \
2040 CC="$(KERNEL_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2041 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2042 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2043 --host=$(AROS_TARGET_CPU)-aros \
2044 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2045 --without-x --without-pic --disable-shared && \
2050 %(mmake)-clean : %(mmake)-uninstall
2051 @$(RM) $(GENDIR)/$(CURDIR)
2054 #############################################################################
2055 #############################################################################
2057 ## Miscellaneous macros. Everything that doesn't fit above should be put ##
2060 #############################################################################
2061 #############################################################################
2063 #----------------------------------------------------------------------------------
2064 # Given an archive name, patches names and locations where to find them, fetch
2065 # the archive and the patches from any of those locations, unpack the archive
2066 # and then apply the patches.
2068 # Locations currently supported are http and ftp sites, plus local filesystem
2069 # directories. Supported archives are .tar.bz2 and .tar.gz. To modify this,
2070 # the fetch.sh script needs to be modified, since this macro relies on that script.
2074 # - archive_origins = list of locations where to find the archive. They are tried
2075 # in sequence, until the archive is found and fetching it
2076 # succeeded. If not specified, the current directory is assumed.
2077 # - archive = the archive name. Mandatory.
2078 # - destination = the local directory where to put the archive and patches.
2079 # If not specified, the current directory is assumed.
2080 # - patches_origins = list of locations where to find the patches. They are tried
2081 # in sequence, until a patch is found and fetching it
2082 # succeeded. If not specified, the current directory is assumed.
2083 # - patches_specs = list of "patch specs". A patch spec is of the form
2084 # patch_name[:[patch_subdir][:patch_opt]].
2086 # - patch_name = the name of the patch file
2087 # - patch_subdir = the directory within \destination\ where to
2089 # - patch_opt = any options to pass to the `patch' command
2090 # when applying the patch.
2092 # The patch_subdir and patch_opt fields are optional.
2094 %define fetch archive_origins=. archive=/A suffixes= destination=. patches_origins=. patches_specs=::
2095 $(FETCH) -ao "%(archive_origins)" -a %(archive) -as "%(suffixes)" -d %(destination) \
2096 -po "%(patches_origins)" -p %(patches_specs)
2099 #-----------------------------------------------------------------------------------------
2100 # Joins the features of %fetch and %build_with_configure, taking advantage of
2101 # the naming scheme of GNU packages. GNU packages names are in the form
2103 # <package name>-<version number>.<archive format suffix>
2105 # If a patch is provided, it *must* be named the following way:
2107 # <package name>-<version number>-aros.diff
2109 # Moreover, it *must* be appliable with the -p1 option of the `patch' command after
2110 # CD'ing into the archive's extracted directory.
2112 # Note that whilst the %fetch macro accepts a list of patches for any given archive,
2113 # the %fetch_and_build macro only accept *one* patch for each package. It's up to you
2114 # to make that patch fully comprehensive.
2116 # NOTE: GNU packages are always compiled with *nix semantics turned on.
2120 # - mmake = the meta make target, as would be supplied to the %build_with_configure
2122 # - package = the GNU package name, sans version and archive format suffixes.
2123 # - version = the package's version number, or otherwise any other version string.
2124 # It gets appended to the package name to form the basename of the archive.
2125 # - suffixes = a list of suffixes to apped to the the package name plus the
2126 # version. Each one of them is tried until a matching archive is found.
2127 # Defaults to "tat.bz2 tar.gz".
2128 # - destination = same meaning as the one for the %fetch macro
2129 # - package_repo = same meaning as the one of the %fetch macro's %(archive_origins) argument
2130 # - patch = "yes" or "no", depending on whether a patch for this package needs to be
2132 # - patch_repo = same meaning as the one of the %fetch macro's %(patches_origins) argument
2133 # - prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2135 # - aros_prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2137 # - extraoptions = same meaning as the one for the %build_with_configure macro.
2138 # - postinstall = same meaning as the one for the %build_with_configure macro.
2140 %define fetch_and_build mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2141 srcdir= package_repo= patch=no patch_repo= prefix= \
2142 aros_prefix= extraoptions= postconfigure= postinstall= nix=no nix_dir_layout=
2144 #MM- %(mmake)-quick : %(mmake)-%(subpackage)-quick
2145 #MM- %(mmake)-%(subpackage)-quick : %(mmake)-%(subpackage)-fetch
2147 %(mmake)-archbase := %(package)-%(version)
2150 %(mmake)-prefix := $(CONTRIB_DIR)/%(package)
2152 %(mmake)-prefix := %(prefix)
2155 ifneq (%(subpackage),)
2156 %(mmake)-%(subpackage)-archbase := %(package)-%(subpackage)-%(version)
2158 %(mmake)-%(subpackage)-archbase := %(package)-%(version)
2162 %(mmake)-%(subpackage)-srcdir := %(srcdir)
2164 %(mmake)-%(subpackage)-srcdir := $(%(mmake)-archbase)
2168 %(mmake)-%(subpackage)-patches_specs := $(%(mmake)-%(subpackage)-archbase)-aros.diff:$(%(mmake)-%(subpackage)-srcdir):-p1
2170 %(mmake)-%(subpackage)-patches_specs := ::
2173 #MM- %(mmake)-fetch : %(mmake)-%(subpackage)-fetch
2175 .PHONY : %(mmake)-%(subpackage)-fetch
2177 %(mmake)-%(subpackage)-fetch :
2178 %fetch archive=$(%(mmake)-%(subpackage)-archbase) suffixes="%(suffixes)" \
2179 destination=$(PORTSDIR)/%(package) \
2180 archive_origins=". %(package_repo)" \
2181 patches_specs="$(%(mmake)-%(subpackage)-patches_specs)" patches_origins=". %(patch_repo)"
2183 #MM- %(mmake) : %(mmake)-%(subpackage)
2185 PACKAGES_DIR := $(AROSDIR)/../Packages
2187 %(mmake)-%(subpackage)-package-dir := $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)
2189 %(mmake)-%(subpackage)-package-basename := \
2190 $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)-aros.$(AROS_TARGET_CPU)
2192 %build_with_configure mmake=%(mmake)-%(subpackage) \
2193 srcdir=$(PORTSDIR)/%(package)/$(%(mmake)-%(subpackage)-srcdir) \
2194 nix=%(nix) nix_dir_layout=%(nix_dir_layout) prefix="$(%(mmake)-%(subpackage)-package-dir)" \
2195 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall) \
2196 %(mmake)-%(subpackage)-make-package" extraoptions="%(extraoptions)"
2198 .PHONY : %(mmake)-%(subpackage)-make-package
2199 #MM %(mmake)-%(subpackage)-make-package : %(mmake)-%(subpackage)-quick
2202 %(mmake)-%(subpackage)-make-package : $(%(mmake)-%(subpackage)-package-basename).tar.bz2
2204 #There seems to be a bug, either with my clock or with make, 'cause it may happen
2205 #that $^ and $@ have exactly the same mtime, and in that case make tries
2206 #to rebuild $@ again, which would fail because the directory where
2207 #the package got installed would not exist anymore.
2208 #We work this around by using an if statement to manually check the mtimes.
2209 $(%(mmake)-%(subpackage)-package-basename).tar.bz2 :
2210 @if test $(GENDIR)/$(CURDIR)/.installed -nt $@ || ! test -f $@; then \
2212 $(ECHO) "Building \`$(%(mmake)-%(subpackage)-package-basename).tar.bz2'" && \
2213 cd $(%(mmake)-%(subpackage)-package-dir) && \
2214 tar -cvf $(%(mmake)-%(subpackage)-package-basename).tar * && \
2215 mkdir -p "$(%(mmake)-prefix)" && \
2216 cd .. && $(RM) -r $(%(mmake)-%(subpackage)-package-dir) && \
2217 tar -xf $(%(mmake)-%(subpackage)-package-basename).tar -C "%(prefix)"/ && \
2218 bzip2 -9 -f $(%(mmake)-%(subpackage)-package-basename).tar && \
2219 cd .. && $(RM) $(%(mmake)-%(subpackage)-archbase); \
2223 %define fetch_and_build_gnu mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2224 srcdir= package_repo= patch=no patch_repo= prefix=$(GNUDIR) \
2225 aros_prefix=/GNU extraoptions= postconfigure= postinstall=
2227 GNU_REPOSITORY := http://ftp.gnu.org/pub/gnu
2229 %fetch_and_build mmake="%(mmake)" package="%(package)" subpackage="%(subpackage)" version="%(version)" \
2230 suffixes="%(suffixes)" srcdir="%(srcdir)" \
2231 package_repo="%(package_repo) $(GNU_REPOSITORY)/%(package)" \
2232 patch="%(patch)" patch_repo="%(patch_repo)" \
2233 prefix="%(prefix)" aros_prefix="%(aros_prefix)" extraoptions="%(extraoptions)" \
2234 postconfigure="%(postconfigure)" postinstall="%(postinstall)" nix=yes
2238 #-----------------------------------------------------------------------------------------
2239 # Same job as the one of %fetch_and_build_gnu, except that this one assumes
2240 # that the package is a "Development" package, and as such it needs to be placed
2241 # under the $(AROS_DEVELOPMENT) directory, as a default.
2243 # All the arguments have the same meaning as the ones of the %fetch_and_build_gnu
2244 # macro, but notice that %fetch_and_build_gnu_development *doesn't* have a
2245 # "mmake" argument, because the metatarget is implicitely defined as
2247 # #MM- development-%(package)
2249 %define fetch_and_build_gnu_development package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2250 srcdir= package_repo= patch=no patch_repo= prefix=$(AROS_DEVELOPMENT) \
2251 aros_prefix=/Development postconfigure= postinstall= extraoptions=
2253 #MM- development : development-%(package)
2256 %fetch_and_build_gnu mmake=development-%(package) package=%(package) subpackage="%(subpackage)" \
2257 version=%(version) suffixes="%(suffixes)" srcdir="%(srcdir)" \
2258 package_repo="%(package_repo)" patch="%(patch)" patch_repo="%(patch_repo)" prefix=%(prefix) \
2259 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall)" \
2260 extraoptions="%(extraoptions)"