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 : %(basename).c
296 %compile_q opt="%(cflags)" cmd=$(TMP_CMD)
299 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(cflags)
301 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(dflags)
303 $(TMP_TARGETBASE).d : %(basename).c
304 %mkdepend_q cc=$(TMP_CMD) flags=$(TMP_DFLAGS)
306 #------------------------------------------------------------------------------
309 #------------------------------------------------------------------------------
310 # Generate a rule to compile multiple C source files to an object file and
311 # generate the corresponding dependency files. The generated file will be put
312 # in the object directory without the directory part of the source file.
314 # - basenames: the basenames of the files to compile. The names may include
315 # relative or absolute path names. No wildcard is allowed
316 # - cflags (default $(CFLAGS)): the C flags to use for compilation
317 # - dflags: the flags used during creation of dependency file. If not specified
318 # the same value as cflags will be used
319 # - targetdir: the directory to put the .o file and the .d file. By default
320 # it is put in the same directory as the .c file. When targetdir is not
321 # empty, path names will be stripped from the file names so that all files
322 # are in that dir and not in subdirectories.
323 # - compiler (default target): compiler to use, either target or host
324 %define rule_compile_multi basenames=/A cflags=$(CFLAGS) dflags= targetdir= \
328 TMP_TARGETS := $(addsuffix .o,%(basenames))
329 TMP_DTARGETS := $(addsuffix .d,%(basenames))
332 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
333 TMP_DTARGETS := $(addsuffix .d,$(addprefix %(targetdir)/,$(notdir %(basenames))))
334 TMP_WILDCARD := %(targetdir)/%
336 # Be sure that all .c files are generated
337 $(TMP_TARGETS) $(TMP_DTARGETS) : | $(addsuffix .c,%(basenames))
339 # Be sure that all .c files are found
340 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
342 vpath %.c $(TMP_DIRS)
347 ifeq ($(findstring %(compiler),host target),)
348 $(error unknown compiler %(compiler))
350 ifeq (%(compiler),target)
351 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(TARGET_CC)
353 ifeq (%(compiler),host)
354 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(HOST_CC)
357 $(TMP_TARGETS) : CFLAGS := %(cflags)
358 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %.c
359 %compile_q cmd=$(CMD)
362 $(TMP_DTARGETS) : DFLAGS:=%(cflags)
364 $(TMP_DTARGETS) : DFLAGS:=%(dflags)
366 $(TMP_DTARGETS) : $(TMP_WILDCARD).d : %.c
367 %mkdepend_q cc=$(CMD) flags=$(DFLAGS)
369 #------------------------------------------------------------------------------
372 #------------------------------------------------------------------------------
373 # Make an alias from one arch specific build to another arch.
375 # - mainmmake: the mmake of the module in the main tree
376 # - arch: the current arch
377 # - alias: the alias to which this should point
378 %define rule_archalias mainmmake=\A arch=\A alias=\A
380 #MM- %(mainmmake)-%(arch) : %(mainmmake)-%(alias)
382 #------------------------------------------------------------------------------
385 #------------------------------------------------------------------------------
386 # Generate a rule to compile a C source file to a shared object file with a
387 # .so suffix. Basename may contain a directory part, then the source
388 # file has to be in that directory. The generated file will be put in the
389 # object directory without the directory.
391 # - basename: the basename of the file to compile. Use % for a wildcard rule
392 # - cflags (default $(CFLAGS)): the C flags to use for compilation
393 # - targetdir: the directory to put the .o file and the .d file. By default
394 # it is put in the same directory as the .c file
395 %define rule_compile_shared basename=/A cflags=$(CFLAGS) targetdir= compiler=target
398 TMP_TARGETBASE := %(basename)
400 TMP_TARGETBASE := %(targetdir)/$(notdir %(basename))
403 ifeq ($(findstring %(compiler),host target),)
404 $(error unknown compiler %(compiler))
406 ifeq (%(compiler),target)
407 $(TMP_TARGETBASE).so : TMP_CMD:=$(TARGET_CC)
409 ifeq (%(compiler),host)
410 $(TMP_TARGETBASE).so : TMP_CMD:=$(HOST_CC)
413 $(TMP_TARGETBASE).so : %(basename).c
414 %compile_q opt="$(SHARED_CFLAGS) %(cflags)" cmd=$(TMP_CMD)
416 #------------------------------------------------------------------------------
419 #------------------------------------------------------------------------------
420 # Generate a rule to assemble a source file to an object file. Basename may
421 # contain a directory part, then the source file has to be in that directory.
422 # The generated file will be put in the object directory without the directory.
424 # - basename: the basename of the file to compile. Use % for a wildcard rule
425 # - flags (default $(AFLAGS)): the asm flags to use for assembling
426 # - targetdir: the directory to put the .o file in. By default it is put in the
427 # same directory as the .s file
428 %define rule_assemble basename=/A aflags=$(AFLAGS) targetdir=
431 %(basename).o : %(basename).s
432 %assemble_q opt=%(aflags)
435 %(targetdir)/$(notdir %(basename)).o : %(basename).s
436 %assemble_q opt=%(aflags)
440 #------------------------------------------------------------------------------
443 #------------------------------------------------------------------------------
444 # Generate a rule to assemble multiple source files to an object file. The
445 # generated file will be put in the object directory with the directory part
446 # of the source file stripped off.
448 # - basenames: the basenames of the files to compile. The names may include
449 # relative or absolute path names. No wildcard is allowed
450 # - aflags (default $(AFLAGS)): the flags to use for assembly
451 # - targetdir: the directory to put the .o file and the .d file. By default
452 # it is put in the same directory as the .c file. When targetdir is not
453 # empty, path names will be stripped from the file names so that all files
454 # are in that dir and not in subdirectories.
455 %define rule_assemble_multi basenames=/A aflags=$(AFLAGS) targetdir= suffix=.s
458 TMP_TARGETS := $(addsuffix .o,%(basenames))
461 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
462 TMP_WILDCARD := %(targetdir)/%
464 # Be sure that all .s files are generated
465 $(TMP_TARGETS) : | $(addsuffix %(suffix),%(basenames))
467 # Be sure that all .c files are found
468 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
470 vpath %%(suffix) $(TMP_DIRS)
475 $(TMP_TARGETS) : AFLAGS := %(aflags)
476 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %%(suffix)
477 %assemble_q opt=$(AFLAGS)
479 #------------------------------------------------------------------------------
482 #------------------------------------------------------------------------------
483 # Link %(objs) to %(prog) using the libraries in %(uselibs)
484 %define rule_link_prog prog=/A objs=/A ldflags=$(LDFLAGS) uselibs= \
485 usehostlibs= usestartup=yes detach=no nix=no
489 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
491 ifeq (%(usestartup),no)
492 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
495 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
497 %(prog) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
499 %(prog) : %(objs) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
500 %link_q from="%(objs)" opt="%(ldflags) $(EXTRA_LDFLAGS)" \
501 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
503 #------------------------------------------------------------------------------
506 #------------------------------------------------------------------------------
507 # Link %(progs) from object in %(objdir) to executables in %(targetdir) using
508 # the AROS libraries in %(uselibs) and the host libraries in %(usehostlibs)
509 %define rule_link_progs progs=/A targetdir=$(AROSDIR)/$(CURDIR) \
510 objdir=$(GENDIR)/$(CURDIR) ldflags=$(LDFLAGS) uselibs= usehostlibs= \
511 usestartup=yes detach=no
515 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
517 ifeq (%(usestartup),no)
518 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
521 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
523 $(addprefix %(targetdir)/,%(progs)) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
525 $(addprefix %(targetdir)/,%(progs)) : %(targetdir)/% : %(objdir)/%.o \
526 $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
527 %link_q from=$< opt="%(ldflags) $(EXTRA_LDFLAGS)" \
528 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
530 #------------------------------------------------------------------------------
533 #------------------------------------------------------------------------------
534 # Link the %(objs) to the library %(libdir)/lib%(libname).a in
535 %define rule_link_linklib libname=/A objs=/A libdir=$(LIBDIR)
537 %(libdir)/lib%(libname).a : %(objs)
540 #------------------------------------------------------------------------------
543 #------------------------------------------------------------------------------
544 # Link the %(objs) to the library %(libdir)/lib%(libname).so in
545 %define rule_link_shlib libname=/A objs=/A libdir=$(LIBDIR)
547 %(libdir)/lib%(libname).so : %(objs)
548 @$(SHARED_LD) $(SHARED_LDFLAGS) -o $@ $^
550 #------------------------------------------------------------------------------
553 #------------------------------------------------------------------------------
554 # Link the %(objs) and %(endobj) to %(module) with errors in %(err) and using
555 # the libraries in %(uselibs) and the host libraries in %(usehostlibs)
556 %define rule_linkmodule module=/A objs=/A endobj=/A err=/A uselibs= usehostlibs=
558 %(module) : OBJS := %(objs)
559 %(module) : ENDTAG := %(endobj)
560 %(module) : ERR := %(err)
561 %(module) : LIBS := $(addprefix -l,%(uselibs)) -lautoinit -llibinit -L/usr/lib $(addprefix -l,%(usehostlibs))
562 %(module) : %(objs) %(endobj) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
563 %link_module_q err=$(ERR) endtag=$(ENDTAG) objs=$(OBJS) libs=$(LIBS)
566 #------------------------------------------------------------------------------
569 #------------------------------------------------------------------------------
570 # Generate a rule to generate a function reference file from a C source file.
571 # Basename may contain a directory part, then the source file has to be in that
572 # directory. The generated file will be put in the object directory without the
575 # - basename: the basename of the file to compile. Use % for a wildcard rule
576 # - cflags (default $(CFLAGS)): the C flags to use for compilation
577 # - targetdir: the directory to put the generated .ref file. By default the
578 # .ref file will be put in the same directory as the .c file.
579 # - includefile: This file will be included at the head of the source file
580 %define rule_ref basename=/A cflags=$(CFLAGS) targetdir= includefile= compiler=target
583 GENFILE_TMP := %(basename).ref
585 GENFILE_TMP := %(targetdir)/$(notdir %(basename)).ref
588 ifeq ($(filter %(compiler),target host),)
589 $(error use of %rule_ref: compiler has to be 'host' or 'target')
592 ifeq (%(compiler),target)
593 $(GENFILE_TMP) : CC:=$(TARGET_CC)
595 $(GENFILE_TMP) : CC:=$(HOST_CC)
598 $(GENFILE_TMP) : %(basename).c $(CXREF) %(includefile)
599 ifeq (%(includefile),)
600 %mkref_q cc=$(CC) cflags="%(cflags)"
602 %mkref_q cc=$(CC) cflags="%(cflags) -include %(includefile)"
606 #------------------------------------------------------------------------------
609 #------------------------------------------------------------------------------
610 # Generate a rule to generate a function reference file from a C source file.
611 # Basename may contain a directory part, then the source file has to be in that
612 # directory. The generated file will be put in the object directory without the
615 # - basenames: the basenames of the files to compile. No wildcard is allowed
616 # - cflags (default $(CFLAGS)): the C flags to use for compilation
617 # - targetdir: the directory to put the generated .ref file. By default the
618 # .ref file will be put in the same directory as the .c file. When targetdir
619 # is not empty all files will be put there and path parts in the basenames
620 # will be stripped off.
621 # - includefile: This file will be included at the head of the source file
622 %define rule_ref_multi basenames=/A cflags=$(CFLAGS) targetdir= includefile= \
626 TMP_TARGETS := $(addsuffix .ref,%(basenames))
627 TMP_WILDCARD := %.ref
629 TMP_TARGETS := $(addprefix %(targetdir)/,$(addsuffix .ref,$(notdir %(basenames))))
630 TMP_WILDCARD := %(targetdir)/%.ref
632 # Be sure that all .c files are generated
633 $(TMP_TARGETS) : | $(addsuffix .c,%(basenames))
635 # Be sure that all .c files are found
636 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
638 vpath %.c $(TMP_DIRS)
643 ifeq ($(filter %(compiler),target host),)
644 $(error use of %rule_ref: compiler has to be 'host' or 'target')
647 ifeq (%(compiler),target)
648 $(TMP_TARGETS) : CC:=$(TARGET_CC)
650 $(TMP_TARGETS) : CC:=$(HOST_CC)
652 ifeq (%(includefile),)
653 $(TMP_TARGETS) : CFLAGS:=%(cflags)
655 $(TMP_TARGETS) : CFLAGS:="%(cflags) -include %(includefile)"
656 $(TMP_TARGETS) : %(includefile)
658 $(TMP_TARGETS) : $(CXREF)
659 $(TMP_TARGETS) : $(TMP_WILDCARD) : %.c
662 #------------------------------------------------------------------------------
665 #------------------------------------------------------------------------------
666 # Generate the libdefs.h include file for a module.
667 %define rule_genmodule_genlibdefs modname=/A modtype=/A modsuffix= conffile= targetdir=
669 TMP_TARGET := %(modname)_libdefs.h
670 TMP_DEPS := $(GENMODULE)
673 TMP_OPTS += -c %(conffile)
674 TMP_DEPS += %(conffile)
676 TMP_DEPS += %(modname).conf
678 ifneq (%(modsuffix),)
679 TMP_OPTS += -s %(modsuffix)
681 ifneq (%(targetdir),)
682 TMP_OPTS += -d %(targetdir)
683 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
686 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
687 $(TMP_TARGET) : MODNAME := %(modname)
688 $(TMP_TARGET) : MODTYPE := %(modtype)
689 $(TMP_TARGET) : $(TMP_DEPS)
690 @$(ECHO) "Generating $(notdir $@)"
691 @$(GENMODULE) $(OPTS) writelibdefs $(MODNAME) $(MODTYPE)
693 #------------------------------------------------------------------------------
696 #------------------------------------------------------------------------------
697 # Generate the libdefs.h include file for a module.
698 %define rule_genmodule_funclist \
699 modname=/A modtype=/A modsuffix= conffile= targetdir= reffile=
701 TMP_TARGET := %(modname).funclist
702 TMP_DEPS := $(GENMODULE)
705 $(error reffile needed in rule_genmodule_funclist but none specified)
707 TMP_OPTS := -r %(reffile)
708 TMP_DEPS += %(reffile)
710 TMP_OPTS += -c %(conffile)
711 TMP_DEPS += %(conffile)
713 TMP_DEPS += %(modname).conf
715 ifneq (%(modsuffix),)
716 TMP_OPTS += -s %(modsuffix)
718 ifneq (%(targetdir),)
719 TMP_OPTS += -d %(targetdir)
720 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
723 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
724 $(TMP_TARGET) : MODNAME := %(modname)
725 $(TMP_TARGET) : MODTYPE := %(modtype)
726 $(TMP_TARGET) : $(TMP_DEPS)
727 @$(ECHO) "Generating $(notdir $@)"
728 @$(GENMODULE) $(OPTS) writefunclist $(MODNAME) $(MODTYPE)
730 #------------------------------------------------------------------------------
733 #------------------------------------------------------------------------------
734 # Generate a Makefile.%(modname) with the genmodule program and include this
735 # generated file in this Makefile
736 %define rule_genmodule_makefile modname=/A modtype=/A modsuffix= conffile= \
739 TMP_TARGET := Makefile.%(modname)
740 TMP_DEPS := $(GENMODULE)
743 TMP_OPTS += -c %(conffile)
744 TMP_DEPS += %(conffile)
746 TMP_DEPS += %(modname).conf
748 ifneq (%(modsuffix),)
749 TMP_OPTS += -s %(modsuffix)
751 ifneq (%(targetdir),)
752 TMP_OPTS += -d %(targetdir)
753 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
756 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
757 $(TMP_TARGET) : MODNAME := %(modname)
758 $(TMP_TARGET) : MODTYPE := %(modtype)
759 $(TMP_TARGET) : $(TMP_DEPS)
760 @$(GENMODULE) $(OPTS) writemakefile $(MODNAME) $(MODTYPE)
762 #------------------------------------------------------------------------------
764 #------------------------------------------------------------------------------
765 # Generate dummy support files so cxref when used on the a module source file
766 # will find something to include. This rule has to be preceeded by
767 # %rule_genmodule_makefile
768 %define rule_genmodule_dummy modname=/A modtype=/A modsuffix= conffile= targetdir=
770 ifneq ($(%(modname)_INCLUDES),)
771 TMP_TARGETS := $(%(modname)_INCLUDES)
773 TMP_DEPS := $(GENMODULE)
776 TMP_OPTS += -c %(conffile)
777 TMP_DEPS += %(conffile)
779 TMP_DEPS += %(modname).conf
781 ifneq (%(modsuffix),)
782 TMP_OPTS += -s %(modsuffix)
784 ifneq (%(targetdir),)
785 TMP_OPTS += -d %(targetdir)
786 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
789 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
790 $(TMP_TARGETS) : MODNAME := %(modname)
791 $(TMP_TARGETS) : MODTYPE := %(modtype)
792 $(TMP_TARGETS) : $(TMP_DEPS)
793 @$(ECHO) "Generating dummy include files"
794 @$(GENMODULE) $(OPTS) writedummy $(MODNAME) $(MODTYPE)
797 #------------------------------------------------------------------------------
800 #------------------------------------------------------------------------------
801 # Generate the support files for compiling a module. This includes include
802 # files and source files. This rule has to be preceeded by
803 # %rule_genmodule_makefile
804 %define rule_genmodule_files modname=/A modtype=/A modsuffix= targetdir= \
807 TMP_TARGETS := $(%(modname)_STARTFILES) $(%(modname)_ENDFILES) \
808 $(%(modname)_LINKLIBFILES)
809 TMP_TARGETS := $(addsuffix .c,$(TMP_TARGETS)) $(addsuffix .S, $(%(modname)_LINKLIBAFILES))
811 TMP_DEPS := $(GENMODULE)
812 ifeq ($(%(modname)_NEEDREF), yes)
814 $(error reffile needed in rule_genmodule_files but none specified)
816 TMP_OPTS := -r %(reffile)
817 TMP_DEPS += %(reffile)
822 TMP_OPTS += -c %(conffile)
823 TMP_DEPS += %(conffile)
825 TMP_DEPS += %(modname).conf
827 ifneq (%(modsuffix),)
828 TMP_OPTS += -s %(modsuffix)
830 ifneq (%(targetdir),)
831 TMP_OPTS += -d %(targetdir)
832 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
835 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
836 $(TMP_TARGETS) : MODNAME := %(modname)
837 $(TMP_TARGETS) : MODTYPE := %(modtype)
838 $(TMP_TARGETS) : $(TMP_DEPS)
839 @$(ECHO) "Generating functable and support files for module $(BD_MODNAME$(BDID))"
840 ifneq (%(conffile),lib.conf)
841 @$(IF) $(TEST) -f lib.conf; then \
842 $(ECHO) "WARNING !!! $(CURDIR)/lib.conf may probably be removed"; \
845 @$(IF) $(TEST) -f libdefs.h; then \
846 $(ECHO) "WARNING !!! $(CURDIR)/libdefs.h may probably be removed"; \
848 @$(GENMODULE) $(OPTS) writefiles $(MODNAME) $(MODTYPE)
850 #------------------------------------------------------------------------------
852 #------------------------------------------------------------------------------
853 # Generate the support files for compiling a module. This includes include
854 # files and source files.
855 %define rule_genmodule_includes modname=/A modtype=/A modsuffix= \
856 targetdir= conffile= reffile=
859 ifneq ($(%(modname)_INCLUDES),)
860 TMP_TARGETS := $(%(modname)_INCLUDES)
862 TMP_DEPS := $(GENMODULE)
863 ifeq ($(%(modname)_NEEDREF), yes)
865 $(error reffile needed in rule_genmodule_files but none specified)
867 TMP_OPTS := -r %(reffile)
868 TMP_DEPS += %(reffile)
873 TMP_OPTS += -c %(conffile)
874 TMP_DEPS += %(conffile)
876 TMP_DEPS += %(modname).conf
878 ifneq (%(modsuffix),)
879 TMP_OPTS += -s %(modsuffix)
881 ifneq (%(targetdir),)
882 TMP_OPTS += -d %(targetdir)
883 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
886 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
887 $(TMP_TARGETS) : MODNAME := %(modname)
888 $(TMP_TARGETS) : MODTYPE := %(modtype)
889 $(TMP_TARGETS) : $(TMP_DEPS)
890 @$(ECHO) "Generating include files"
891 @$(GENMODULE) $(OPTS) writeincludes $(MODNAME) $(MODTYPE)
894 #------------------------------------------------------------------------------
896 #------------------------------------------------------------------------------
897 # Common rules for all makefiles
899 # Delete generated makefiles
902 @$(RM) $(TOP)/$(CURDIR)/mmakefile $(TOP)/$(CURDIR)/mmakefile.bak
904 include $(TOP)/config/make.tail
906 BDID := $(BDTARGETID)
908 #------------------------------------------------------------------------------
911 #############################################################################
912 #############################################################################
914 ## Here are the mmakefile build macro's. These are macro's that takes care ##
915 ## of everything to go from the sources to the generated target. Also all ##
916 ## intermediate files and directories that are needed are created by these ##
919 #############################################################################
920 #############################################################################
922 #------------------------------------------------------------------------------
924 %define build_prog mmake=/A progname=/A files=$(BD_PROGNAME$(BDID)) asmfiles= \
925 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
926 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
927 aflags=$(AFLAGS) uselibs= usehostlibs= usestartup=yes detach=no nix=no
931 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
933 BD_PROGNAME$(BDID) := %(progname)
934 BD_OBJDIR$(BDID) := %(objdir)
935 BD_TARGETDIR$(BDID) := %(targetdir)
937 BD_FILES$(BDID) := %(files)
938 BD_ASMFILES$(BDID) := %(asmfiles)
939 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID)) $(BD_ASMFILES$(BDID))))
940 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
942 BD_CFLAGS$(BDID) := %(cflags)
943 BD_AFLAGS$(BDID) := %(aflags)
944 BD_DFLAGS$(BDID) := %(dflags)
945 BD_LDFLAGS$(BDID) := %(ldflags)
948 %(mmake)-quick : %(mmake)
951 %(mmake) : $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID))
953 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
954 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
955 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
956 %rule_assemble_multi basenames=$(BD_ASMFILES$(BDID)) targetdir=$(BD_OBJDIR$(BDID)) \
957 aflags=$(BD_AFLAGS$(BDID))
959 %rule_link_prog prog=$(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) \
960 objs=$(BD_OBJS$(BDID)) ldflags=$(BD_LDFLAGS$(BDID)) \
961 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
962 usestartup="%(usestartup)" detach="%(detach)" nix="%(nix)"
966 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
968 $(BD_OBJS$(BDID)) $(BD_DEPS$(BDID)) : | $(BD_OBJDIR$(BDID))
969 $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) : | $(BD_TARGETDIR$(BDID))
970 GLOB_MKDIRS += $(BD_OBJDIR$(BDID)) $(BD_TARGETDIR$(BDID))
973 #------------------------------------------------------------------------------
976 #------------------------------------------------------------------------------
977 # Build programs, for every C file an executable will be built with the same
979 %define build_progs mmake=/A files=/A \
980 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
981 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
982 uselibs= usehostlibs= usestartup=yes detach=no
986 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
988 BD_OBJDIR$(BDID) := %(objdir)
989 BD_TARGETDIR$(BDID) := %(targetdir)
991 BD_FILES$(BDID) := %(files)
992 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
993 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
994 BD_EXES$(BDID) := $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID)))
996 BD_CFLAGS$(BDID) := %(cflags)
997 ifneq ($(strip $(filter arosc_shared,%(uselibs))),)
998 BD_CFLAGS$(BDID) += -D_CLIB_LIBRARY_ -I$(TOP)/rom/exec
1000 BD_DFLAGS$(BDID) := %(dflags)
1001 BD_LDFLAGS$(BDID) := %(ldflags)
1004 %(mmake)-quick : %(mmake)
1007 %(mmake) : $(BD_EXES$(BDID))
1009 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
1010 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
1011 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
1013 %rule_link_progs progs=$(BD_FILES$(BDID)) \
1014 targetdir=$(BD_TARGETDIR$(BDID)) objdir=$(BD_OBJDIR$(BDID)) \
1015 ldflags=$(BD_LDFLAGS$(BDID)) \
1016 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
1017 usestartup="%(usestartup)" detach="%(detach)"
1021 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
1023 $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID))) : | $(BD_TARGETDIR$(BDID))
1024 $(BD_DEPS$(BDID)) $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1025 GLOB_MKDIRS += $(BD_TARGETDIR$(BDID)) $(BD_OBJDIR$(BDID))
1028 #------------------------------------------------------------------------------
1031 #------------------------------------------------------------------------------
1033 # This is a bare version: It just compiles and links the given files. It is
1034 # assumed that all needed boiler plate code is in the files. This should only
1035 # be used for compiling external code. For AROS code use %build_module
1036 %define build_module_simple mmake=/A modname=/A modtype=/A \
1037 files="$(basename $(wildcard *.c))" \
1038 cflags=$(CFLAGS) dflags=$(BD_DEFDFLASGS) \
1039 objdir=$(OBJDIR) moduledir= \
1040 uselibs= usehostlibs= compiler=target
1042 # Define metamake targets and their dependencies
1043 #MM %(mmake) : core-linklibs includes-generate-deps
1044 #MM %(mmake)-kobj : core-linklibs includes-generate-deps
1048 BD_ALLTARGETS := %(mmake) %(mmake)-clean %(mmake)-quick %(mmake)-kobj
1050 .PHONY : $(BD_ALLTARGETS)
1053 $(error using %build_module_simple: modname may not be empty)
1056 $(error using %build_module_simple: $(MODTYPE) has to be defined with the type of the module)
1059 # Default values for variables and arguments
1060 BD_DEFLINKLIBNAME := %(modname)
1061 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1062 BD_DEFDFLAGS := %(cflags)
1063 OBJDIR ?= $(GENDIR)/$(CURDIR)
1064 BD_MODDIR := %(moduledir)
1065 ifeq ($(BD_MODDIR),)
1066 ifeq (%(modtype),library)
1067 BD_MODDIR := $(AROS_LIBS)
1069 ifeq (%(modtype),gadget)
1070 BD_MODDIR := $(AROS_GADGETS)
1072 ifeq (%(modtype),datatype)
1073 BD_MODDIR := $(AROS_DATATYPES)
1075 ifeq (%(modtype),handler)
1076 BD_MODDIR := $(AROS_FS)
1078 ifeq (%(modtype),device)
1079 BD_MODDIR := $(AROS_DEVS)
1081 ifeq (%(modtype),resource)
1082 BD_MODDIR := $(AROS_RESOURCES)
1084 ifeq (%(modtype),mui)
1085 BD_MODDIR := $(AROS_CLASSES)/Zune
1087 ifeq (%(modtype),mcc)
1088 BD_MODDIR := $(AROS_CLASSES)/Zune
1090 ifeq (%(modtype),mcp)
1091 BD_MODDIR := $(AROS_CLASSES)/Zune
1093 ifeq (%(modtype),hidd)
1094 BD_MODDIR := $(AROS_DRIVERS)
1097 ifeq ($(BD_MODDIR),)
1098 $(error Don't where to put the file for modtype %(modtype). Specify moduledir=)
1101 %rule_compile_multi \
1102 basenames="%(files)" targetdir="%(objdir)" \
1103 cflags="%(cflags)" dflags="%(dflags)" \
1104 compiler=%(compiler)
1106 BD_MODULE := $(BD_MODDIR)/%(modname).%(modtype)
1107 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1109 %(mmake)-quick : %(mmake)
1110 %(mmake) : $(BD_MODULE)
1111 %(mmake)-kobj : $(BD_KOBJ)
1113 # The module is linked from all the compiled .o files
1114 BD_OBJS := $(addprefix %(objdir)/, $(addsuffix .o,%(files)))
1115 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1116 endobj= err=%(modname).err \
1117 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1119 # Link kernel object file
1120 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1122 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1123 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1124 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1125 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1126 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1127 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1128 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1129 @$(ECHO) "Linking $@"
1130 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1131 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1134 ## Dependency fine-tuning
1136 BD_DEPS := $(addprefix %(objdir), $(addsuffix .o,%(files)))
1137 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1139 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1140 $(BD_MODULE) : | $(BD_MODDIR)
1141 $(BD_KOBJ) : | $(KOBJSDIR)
1142 GLOB_MKDIRS += %(objdir) $(BD_MODDIR) $(KOBJSDIR)
1144 %(mmake)-clean : FILES := $(BD_OBJS) $(BD_MODULE) $(BD_KOBJ) $(BD_DEPS)
1146 @$(ECHO) "Cleaning up for module %(modname)"
1147 @$(RM) $(BD_OBJS) $(BD_KOBJ)
1151 #------------------------------------------------------------------------------
1153 # Explanation of this macro is done in the developer's manual
1154 %define build_module mmake=/A modname=/A modtype=/A modsuffix= \
1155 conffile= files="$(basename $(wildcard *.c))" \
1156 linklibfiles= cflags=$(CFLAGS) dflags=$(BD_DEFDFLAGS) \
1157 objdir=$(OBJDIR) moduledir=$(BD_DEFMODDIR) prefix=$(AROSDIR) \
1158 reffile=$(BD_DEFREFFILE) noref= \
1159 linklibname=$(BD_DEFLINKLIBNAME) uselibs= usehostlibs= \
1160 compiler=target genincludes=
1162 # Define metamake targets and their dependencies
1163 #MM- includes-all : %(mmake)-includes
1164 #MM %(mmake) : %(mmake)-includes core-linklibs
1165 #MM %(mmake)-kobj : %(mmake)-includes core-linklibs
1166 #MM %(mmake)-linklib : %(mmake)-includes
1167 #MM %(mmake)-quick : %(mmake)-includes-quick
1168 #MM %(mmake)-includes : %(mmake)-makefile %(mmake)-includes-dirs \
1169 #MM includes-generate-deps
1170 #MM %(mmake)-includes-quick
1171 #MM %(mmake)-includes-dirs
1172 #MM %(mmake)-makefile
1173 #MM %(mmake)-funclist
1176 # All MetaMake targets defined by this macro
1177 BD_ALLTARGETS := %(mmake) %(mmake)-quick %(mmake)-includes \
1178 %(mmake)-includes-quick %(mmake)-includes-dirs %(mmake)-clean \
1179 %(mmake)-kobj %(mmake)-funclist %(mmake)-linklib
1181 .PHONY : $(BD_ALLTARGETS) %(mmake)-makefile
1184 $(error using %build_module: modname may not be empty)
1187 $(error using %build_module: $(MODTYPE) has to be defined with the type of the module)
1190 # Default values for variables and arguments
1191 BD_DEFLINKLIBNAME := %(modname)
1192 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1193 BD_DEFDFLAGS := %(cflags)
1194 OBJDIR ?= $(GENDIR)/$(CURDIR)
1196 ## Create genmodule include Makefile for the module
1198 %(mmake)-makefile : %(objdir)/Makefile.%(modname)
1200 %rule_genmodule_makefile \
1201 modname=%(modname) modtype=%(modtype) \
1202 modsuffix=%(modsuffix) targetdir=%(objdir) \
1203 conffile=%(conffile)
1205 %(objdir)/Makefile.%(modname) : | %(objdir)
1207 GLOB_MKDIRS += %(objdir)
1209 # Do not parse these statements if metatarget is not appropriate
1210 ifneq ($(filter $(TARGET),$(BD_ALLTARGETS)),)
1212 include %(objdir)/Makefile.%(modname)
1214 BD_DEFMODDIR := $(%(modname)_MODDIR)
1217 ## include files generation
1219 BD_INCDIR := %(prefix)/$(AROS_DIR_INCLUDE)
1220 ifeq (%(genincludes),yes)
1221 %(modname)_INCLUDES := proto/%(modname).h clib/%(modname)_protos.h defines/%(modname).h
1223 ifeq (%(genincludes),no)
1224 %(modname)_INCLUDES :=
1226 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1227 BD_DEFLIBDEFSINC := %(objdir)/%(modname)_deflibdefs.h
1229 %(mmake)-includes-quick : %(mmake)-includes
1230 %(mmake)-includes : $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1231 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1232 $(BD_LIBDEFSINC) $(BD_DEFLIBDEFSINC)
1234 ifneq ($(%(modname)_INCLUDES),)
1235 %rule_genmodule_includes modname=%(modname) modtype=%(modtype) \
1236 modsuffix=%(modsuffix) targetdir=%(objdir)/include \
1237 conffile=%(conffile) reffile=%(reffile)
1239 %rule_copy_diff_multi \
1240 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(GENINCDIR) \
1241 stampfile=%(objdir)/%(modname)_geninc
1243 %rule_copy_diff_multi \
1244 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(BD_INCDIR) \
1245 stampfile=%(objdir)/%(modname)_incs
1247 %rule_genmodule_dummy modname=%(modname) modtype=%(modtype) \
1248 modsuffix=%(modsuffix) \
1249 targetdir=%(objdir)/dummyinc conffile=%(conffile)
1251 BD_INCDIRS := $(filter-out ./,$(sort $(dir $(%(modname)_INCLUDES))))
1253 TMP%(modname)_INCDIRS := \
1254 %(objdir)/include $(addprefix %(objdir)/include/,$(BD_INCDIRS)) \
1255 $(GENINCDIR) $(addprefix $(GENINCDIR)/,$(BD_INCDIRS)) \
1256 $(BD_INCDIR) $(addprefix $(BD_INCDIR)/,$(BD_INCDIRS))
1257 %rule_makedirs dirs=$(TMP%(modname)_INCDIRS) setuptarget=%(mmake)-includes-dirs
1259 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES)) : | %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1260 GLOB_MKDIRS += %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1264 %rule_genmodule_genlibdefs modname=%(modname) modtype=%(modtype) \
1265 modsuffix=%(modsuffix) targetdir=%(objdir) \
1266 conffile=%(conffile)
1268 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1270 %(objdir)/%(modname)_deflibdefs.h : FILENAME := $(BD_LIBDEFSINC)
1271 %(objdir)/%(modname)_deflibdefs.h :
1272 @$(ECHO) "generating $@"
1273 @$(ECHO) "#define LC_LIBDEFS_FILE \"$(FILENAME)\"" >$@
1276 ## Generation of the funclist file
1278 %(mmake)-funclist : %(modname).funclist
1280 %rule_genmodule_funclist \
1281 modname=%(modname) modtype=%(modtype) modsuffix=%(modsuffix) \
1282 conffile=%(conffile) reffile=%(reffile)
1285 ## Extra genmodule src files generation
1287 %rule_genmodule_files modname=%(modname) modtype=%(modtype) \
1288 modsuffix=%(modsuffix) targetdir=%(objdir) \
1289 conffile=%(conffile) reffile=%(reffile)
1293 BD_FILES := %(files)
1294 BD_STARTFILES := $(addprefix %(objdir)/,$(%(modname)_STARTFILES))
1295 BD_ENDFILES := $(addprefix %(objdir)/,$(%(modname)_ENDFILES))
1297 BD_ARCHOBJS := $(wildcard %(objdir)/arch/*.o)
1298 BD_ARCHFILES := $(basename $(notdir $(BD_ARCHOBJS)))
1299 BD_NARCHFILES := $(filter-out $(BD_ARCHFILES),$(BD_FILES))
1301 BD_CFLAGS := %(cflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1302 BD_DFLAGS := %(dflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1304 BD_LINKLIBCFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBFILES))
1305 BD_LINKLIBAFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBAFILES))
1306 ifeq ($(strip $(%(modname)_LINKLIBFILES) %(linklibfiles)),)
1309 BD_LINKLIB := %(prefix)/$(AROS_DIR_LIB)/lib%(linklibname).a
1311 BD_LINKLIBFILES := $(BD_LINKLIBCFILES) $(BD_LINKLIBAFILES)
1313 BD_CCFILES := $(BD_NARCHFILES) $(BD_STARTFILES) \
1314 $(BD_ENDFILES) $(BD_LINKLIBCFILES) %(linklibfiles)
1316 %rule_compile_multi \
1317 basenames=$(BD_CCFILES) targetdir=%(objdir) \
1318 cflags=$(BD_CFLAGS) dflags=$(BD_DFLAGS) \
1319 compiler=%(compiler)
1321 ifneq ($(BD_LINKLIBAFILES),)
1322 %rule_assemble_multi \
1323 basenames=$(BD_LINKLIBAFILES) targetdir=%(objdir) suffix=.S
1326 ## function reference files generation
1329 basenames=$(BD_FILES) targetdir=%(objdir) \
1330 cflags="-I$(dir $(GENMODULE))/genmod_inc -I%(objdir)/dummyinc $(strip $(BD_CFLAGS))" \
1331 compiler=%(compiler)
1334 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(BD_FILES))))
1336 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(filter-out %(noref),$(BD_FILES)))))
1339 %rule_join from=$(BD_REFS) to=%(reffile) \
1340 text="Collecting function references for module %(modname)"
1345 ifeq (%(modsuffix),)
1346 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modtype)
1347 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1349 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modsuffix)
1350 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modsuffix).o
1353 %(mmake)-quick : %(mmake)
1354 %(mmake) : $(BD_MODULE) $(BD_LINKLIB)
1355 %(mmake)-kobj : $(BD_KOBJ) $(BD_LINKLIB)
1356 %(mmake)-linklib : $(BD_LINKLIB)
1358 BD_OBJS := $(addsuffix .o,$(BD_STARTFILES)) $(BD_ARCHOBJS) \
1359 $(addsuffix .o, $(addprefix %(objdir)/,$(notdir $(BD_NARCHFILES))))
1360 BD_ENDOBJS := $(addsuffix .o,$(BD_ENDFILES))
1361 BD_LINKLIBOBJS:= $(addsuffix .o,$(addprefix %(objdir)/,$(notdir %(linklibfiles))) $(BD_LINKLIBFILES))
1363 # The module is linked from all the compiled .o files
1364 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1365 endobj=$(BD_ENDOBJS) err=$(BD_MODNAME).err \
1366 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1369 ifneq ($(BD_LINKLIB),)
1370 %rule_link_linklib libname=%(linklibname) objs=$(BD_LINKLIBOBJS) libdir=%(prefix)/$(AROS_DIR_LIB)
1372 $(BD_LINKLIB) : | %(prefix)/$(AROS_DIR_LIB)
1373 GLOB_MKDIRS += %(prefix)/$(AROS_DIR_LIB)
1376 # Link kernel object file
1377 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1379 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1380 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1381 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1382 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1383 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1384 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1385 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1386 @$(ECHO) "Linking $@"
1387 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1388 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1390 ## Dependency fine-tuning
1392 BD_DEPS := $(addsuffix .d,$(addprefix %(objdir)/,$(notdir $(BD_CCFILES))))
1393 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1395 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1396 $(BD_MODULE) : | %(prefix)/%(moduledir)
1397 $(BD_KOBJ) : | $(KOBJSDIR)
1398 GLOB_MKDIRS += %(objdir) %(prefix)/%(moduledir) $(KOBJSDIR)
1400 # Some include files need to be generated before the .c can be parsed.
1401 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-includes %(mmake)-quick %(mmake)-kobj),) # Only for this target these deps are wanted
1402 BD_REFFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1403 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES))
1404 $(BD_REFS) : $(BD_REFFILE_DEPS) $(dir $(GENMODULE))/genmod_inc/aros/libcall.h
1406 BD_DFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1407 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES))
1408 $(BD_DEPS) : $(BD_DFILE_DEPS)
1411 BD_TOCLEAN := $(BD_OBJS) $(BD_DEPS) %(reffile) \
1412 $(BD_REFS) $(BD_MODULE) $(BD_LINKLIB) $(BD_KOBJ) \
1413 $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1414 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1415 $(addprefix .c,$(BD_LINKLIBFILES)) $(BD_LINKLIBOBJS) $(BD_LIBDEFSINC) \
1416 %(objdir)/%(modname)_deflibdefs.h \
1417 $(addsuffix .c,$(BD_STARTFILES) $(BD_ENDFILES)) \
1419 %(mmake)-clean : FILES := $(BD_TOCLEAN)
1421 @$(ECHO) "Cleaning up for module %(modname)"
1424 endif # $(TARGET) in $(BD_ALLTARGETS)
1426 #------------------------------------------------------------------------------
1429 #------------------------------------------------------------------------------
1431 # - mmake is the mmaketarget
1432 # - libname is the baselibname e.g. lib%(libname).a will be created
1433 # - files are the C source files to include in the lib. The list of files
1434 # has to be given without the .c suffix
1435 # - asmfiles are the asm files to include in the lib. The list of files has to
1436 # be given with the .s suffix
1437 # - cflags are the flags to compile the source (default $(CFLAGS))
1438 # - dflags are the flags use during makedepend (default equal to cflags)
1439 # - aflags are the flags use during assembling (default $(AFLAGS))
1440 # - objdir is where the .o are generated
1441 # - libdir is the directory where the linklib will be placed (default $(LIBDIR))
1442 %define build_linklib mmake=/A libname=/A files="$(basename $(wildcard *.c))" \
1443 asmfiles= cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) objdir=$(OBJDIR) libdir=$(LIBDIR)
1445 %buildid targets="%(mmake) %(mmake)-clean"
1447 # assign and generate the local variables used in this macro
1448 BD_LIBNAME$(BDID) := %(libname)
1449 OBJDIR ?= $(GENDIR)/$(CURDIR)
1450 BD_OBJDIR$(BDID) := %(objdir)
1451 BD_LIBDIR$(BDID) := %(libdir)
1453 BD_FILES$(BDID) := %(files)
1454 BD_ASMFILES$(BDID) := %(asmfiles)
1455 BD_SRCS$(BDID) := $(addsuffix .c,$(BD_FILES$(BDID)))
1456 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir $(BD_FILES$(BDID)) $(BD_ASMFILES$(BDID)))))
1457 BD_DEPS$(BDID) := $(patsubst %.o,%.d,$(BD_OBJS$(BDID)))
1459 BD_CFLAGS$(BDID) := %(cflags)
1461 BD_DFLAGS$(BDID) := $(BD_CFLAGS$(BDID))
1463 BD_DFLAGS$(BDID) := %(dflags)
1465 BD_AFLAGS$(BDID) := %(aflags)
1467 BD_LINKLIB$(BDID) := $(BD_LIBDIR$(BDID))/lib$(BD_LIBNAME$(BDID)).a
1469 .PHONY : %(mmake) %(mmake)-clean
1472 %(mmake) : $(BD_LINKLIB$(BDID))
1476 @$(RM) $(BD_OBJS$(BDID)) $(BD_DEPS$(BDID))
1478 ifeq ($(TARGET),%(mmake))
1479 ifneq ($(dir $(BD_FILES$(BDID))),./)
1480 vpath %.c $(filter-out ./,$(dir $(BD_FILES$(BDID))))
1483 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
1484 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
1485 %rule_assemble basename=% targetdir=$(BD_OBJDIR$(BDID)) \
1486 aflags=$(BD_AFLAGS$(BDID))
1489 %rule_link_linklib libname=%(libname) objs=$(BD_OBJS$(BDID)) libdir=$(BD_LIBDIR$(BDID))
1491 %include_deps depstargets=%(mmake) deps=$(BD_DEPS$(BDID))
1493 $(BD_OBJS$(BDID)) $(BD_DEPS$(BDID)) : | $(BD_OBJDIR$(BDID))
1494 $(BD_LINKLIB$(BDID)) : | $(BD_LIBDIR$(BDID))
1495 GLOB_MKDIRS += $(BD_OBJDIR$(BDID)) $(BD_LIBDIR$(BDID))
1498 #------------------------------------------------------------------------------
1501 #------------------------------------------------------------------------------
1503 # - mmake is the mmaketarget
1504 # - catalogs is the list of catalogs, without the .ct suffix (default *.ct)
1505 # - description is the catalog description file (.cd) (default *.cd)
1506 # - subdir is the destination subdir of the catalogs
1507 # - name is the name of the destination catalog, without the .catalog suffix
1508 # - source is the path to the generated source code file
1509 # - dir is the base destination directory (default $(AROS_CATALOGS))
1510 # - sourcedescription is the path to the FlexCat's source description file, without the .sd suffix
1512 %define build_catalogs mmake=/A name=/A subdir=/A \
1513 catalogs="$(basename $(wildcard *.ct))" source="../strings.h" \
1514 description="$(basename $(wildcard *.cd))" dir=$(AROS_CATALOGS) \
1515 sourcedescription="$(TOOLDIR)/C_h_orig"
1517 %buildid targets="%(mmake) %(mmake)-clean"
1519 BD_SRCS$(BDID) := $(foreach name, %(catalogs), $(name).ct)
1520 BD_OBJS$(BDID) := $(foreach name, %(catalogs), %(dir)/$(name)/%(subdir)/%(name).catalog)
1521 BD_DIRS$(BDID) := $(foreach name, %(catalogs), %(dir)/$(name)/%(subdir))
1524 %(mmake) : $(BD_OBJS$(BDID)) %(source)
1526 $(BD_OBJS$(BDID)) : | $(BD_DIRS$(BDID))
1527 GLOB_MKDIRS += $(BD_DIRS$(BDID))
1529 %(dir)/%/%(subdir)/%(name).catalog : %.ct %(description).cd
1530 @$(ECHO) "Creating %(name) catalog for language $*."
1531 @$(FLEXCAT) %(description).cd $*.ct CATALOG=%(dir)/$*/%(subdir)/%(name).catalog || [ $$? -lt 10 ]
1534 %(source) : %(description).cd
1535 @$(ECHO) "Creating %(name) catalog source file %(source)"
1536 @$(FLEXCAT) %(description).cd %(source)=%(sourcedescription).sd
1541 $(RM) $(BD_OBJS$(BDID)) %(source)
1543 .PHONY: %(mmake) %(mmake-clean)
1547 #-----------------------------------------------------------------------------
1549 #-----------------------------------------------------------------------------
1551 # - mmake is the mmaketarget
1552 # - icons is a list of icon base names (ie. without the .info suffix)
1553 # - dir is the destination directory
1554 #-----------------------------------------------------------------------------
1556 %define build_icons mmake=/A icons=/A dir=/A
1558 %buildid targets="%(mmake) %(mmake)-clean"
1560 BD_OBJS$(BDID) := $(foreach icon, %(icons), %(dir)/$(icon).info)
1563 %(mmake) : $(BD_OBJS$(BDID))
1565 %(dir)/%.info : %.info.src %.png
1566 @$(ECHO) Creating $(notdir $@)...
1567 @$(ILBMTOICON) $+ $@
1569 $(BD_OBJS$(BDID)) : | %(dir)
1570 GLOB_MKDIRS += %(dir)
1574 @$(RM) $(BD_OBJS$(BDID))
1580 #-----------------------------------------------------------------------------
1582 #------------------------------------------------------------------------------
1583 # Compile files for an arch-specific replacement of code for a module
1584 # - files: the basenames of the C files to compile.
1585 # - asmfiles: the basenames of the asm files to assemble.
1586 # - mainmmake: the mmake of the module in the main directory to compile these
1587 # arch specific files for.
1588 # - maindir: the object directory for the main module
1589 # - arch: the arch for which to compile these files. It can have the form
1590 # of ARCH, CPU or ARCH-CPU, e.g. linux, i386 or linux-i386
1591 # - cflags (default $(CFLAGS)): the C flags to use for compilation
1592 # - dflags: the flags used during creation of dependency file. If not specified
1593 # the same value as cflags will be used
1594 # - aflags: the flags used during assembling
1595 # - compiler: (host or target) specifies which compiler to use. By default
1596 # the target compiler is used
1597 %define build_archspecific files= asmfiles= mainmmake=/A maindir=/A arch=/A \
1598 cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) compiler=target modulename=
1600 ifeq (%(files) %(asmfiles),)
1601 $(error no files or asmfiles given)
1604 %buildid targets="%(mainmmake)-%(arch)"
1606 #MM- %(mainmmake) : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1607 #MM- %(mainmmake)-linklib : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1608 #MM- %(mainmmake)-kobj : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1610 #MM %(mainmmake)-%(arch) : %(mainmmake)-includes
1613 $(error argument arch has to be non empty for the rule_compile_archspecific macro)
1616 BD_OBJDIR$(BDID) := $(GENDIR)/%(maindir)/arch
1617 BD_COBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1618 BD_ASMOBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(asmfiles))))
1619 BD_OBJS$(BDID) := $(BD_COBJS$(BDID)) $(BD_ASMOBJS$(BDID))
1620 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1622 ifeq ($(TARGET),%(mainmmake)-%(arch))
1623 vpath %.c $(filter-out ./,$(dir %(files)))
1624 vpath %.s $(filter-out ./,$(dir %(asmfiles)))
1625 vpath %.S $(filter-out ./,$(dir %(asmfiles)))
1628 $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1629 GLOB_MKDIRS += $(BD_OBJDIR$(BDID))
1632 %(mainmmake)-%(arch) :: $(BD_OBJS$(BDID))
1634 ifeq ($(findstring %(compiler),host target),)
1635 $(error unknown compiler %(compiler))
1637 ifeq (%(compiler),target)
1638 $(BD_COBJS$(BDID)) : TMP_CMD:=$(TARGET_CC)
1640 ifeq (%(compiler),host)
1641 $(BD_COBJS$(BDID)) : TMP_CMD:=$(HOST_CC)
1643 ifneq (%(modulename),)
1644 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags) -I$(GENDIR)/%(maindir) \
1645 --include $(GENDIR)/%(maindir)/%(modulename)_deflibdefs.h
1647 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags)
1649 ifeq ($(TARGET),%(mainmmake)-%(arch))
1650 $(BD_OBJDIR$(BDID))/%.o : %.c
1651 %compile_q opt=$(TMP_CFLAGS) cmd=$(TMP_CMD)
1655 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(cflags)
1657 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(dflags)
1659 ifeq ($(TARGET),%(mainmmake)-%(arch))
1660 $(BD_OBJDIR$(BDID))/%.d : %.c
1661 %mkdepend_q flags=$(TMP_DFLAGS)
1664 $(BD_ASMOBJS$(BDID)) : AFLAGS:=%(aflags)
1666 ifeq ($(TARGET),%(mainmmake)-%(arch))
1667 $(BD_OBJDIR$(BDID))/%.o : %.s
1668 %assemble_q opt=$(AFLAGS)
1669 $(BD_OBJDIR$(BDID))/%.o : %.S
1670 %assemble_q opt=$(AFLAGS)
1673 %include_deps depstargets=%(mainmmake)-%(arch) deps=$(BD_DEPS$(BDID))
1675 #------------------------------------------------------------------------------
1683 # ======================
1684 # Old stuff, will probably be removed in the future
1689 # GNU Make automatic variables
1691 # $< First dependency
1692 # $? All newer dependencies
1693 # $^ All dependencies
1694 # $* The stem (ie. target is dir/a.foo.b and the pattern is
1695 # a.%.b, then the stem is dir/foo)
1697 #------------------------------------------------------------------------------
1698 # rule to generate libdefs.h with archtool (options may go away!)
1699 %define libdefs_rule conffile=lib.conf genlibdefstool=$(ARCHTOOL) dest=libdefs.h
1700 %(dest) : %(conffile) %(genlibdefstool)
1701 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1702 @%(genlibdefstool) -c -o $@ %(conffile)
1706 #------------------------------------------------------------------------------
1707 # generate asm files from c files (for debugging purposes)
1710 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1711 @$(TARGET_CC) -S $(CFLAGS) $< -c -o $@
1714 #------------------------------------------------------------------------------
1715 # Convert two png images to an Amiga icon file based on the description
1716 # file %(from), with outputfile going to %(to).
1717 %define makeicon2 from=$< to=$@ img1="$(basename $(basename $<))_N.png" img2="$(basename $(basename $<))_S.png"
1718 @$(ECHO) "Creating icon %(to)..."
1719 @$(PNGTOPNM) %(img1) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon1.iff
1720 @$(PNGTOPNM) %(img2) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon2.iff
1721 @$(ILBMTOICON) %(from) $(GENDIR)/genicon1.iff $(GENDIR)/genicon2.iff %(to)
1724 #------------------------------------------------------------------------------
1725 # NOTE: The following are all part of Iain's build changes, please don't use
1726 # or change anything below this line until you know what you are doing. This
1727 # is so that I don't conflict with the semantics of any of the above macros.
1728 #------------------------------------------------------------------------------
1730 #------------------------------------------------------------------------------
1731 # Copy files from one directory to another.
1733 %define copy_files_q files=$(FILES) src=. dst=/A maketarget=files-copy
1735 SRC_FILES := $(foreach f, %(files), %(src)/$(f))
1736 DST_FILES := $(foreach f, %(files), %(dst)/$(f))
1738 %(maketarget) : setup $(DST_FILES)
1740 $(DST_FILES) : %(dst)/% : %(src)/%
1748 #----------------------------------------------------------------------------------
1749 # Copy a diretory recursively to another place, preserving the original
1750 # hierarchical structure
1752 # src: the source directory whose content will be copied
1753 # dst: the directory where to copy src's content. If not existing, it will be made.
1755 %define copy_dir_recursive mmake=/A src=$(TOP)/$(CURDIR) dst=/A
1757 %(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)
1758 %(mmake)_DIRS := $(sort $(foreach f,$(%(mmake)_FILES),$(dir $(f))))
1760 define %(mmake)_mkdir
1765 define %(mmake)_copy
1766 $(3)/$(1): $(2)/$(1) | $(dir $(3)/$(1))
1773 %(mmake): | $(GENDIR)/$(CURDIR)
1774 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1775 $(ECHO) "all: $(addprefix \$$(DST)/,$(%(mmake)_FILES))" > $$m
1776 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1777 for d in $(%(mmake)_DIRS); do \
1778 $(ECHO) "\$$(DST)/$$d: ; $(MKDIR) \$$@" >> $$m; \
1780 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1781 for f in $(%(mmake)_FILES); do \
1782 $(ECHO) "\$$(DST)/$$f: \$$(SRC)/$$f | \$$(dir \$$(DST)/$$f); $(CP) \$$< \$$@" >> $$m; \
1784 for dst in %(dst); do \
1785 $(MAKE) -f $$m DST=$$dst SRC=%(src) all; \
1788 $(GENDIR)/$(CURDIR):
1793 #------------------------------------------------------------------------------
1794 # Copy include files into the includes directories. There are currently
1795 # two include directories. One for building AROS $(AROS_INCLUDES) and one
1796 # for building tools that need to run on the host system $(GENINCDIR). The
1797 # $(GENINCDIR) path must not contain any references to the C runtime
1798 # library header files.
1800 %define copy_includes mmake=includes-copy includes=$(INCLUDE_FILES) path=. dir=
1803 INCL_FILES_1 := $(subst %(dir),$(AROS_INCLUDES)/%(path),%(includes))
1804 INCL_FILES_2 := $(subst %(dir),$(GENINCDIR)/%(path),%(includes))
1805 _INC_PATH := %(dir)/
1807 INCL_FILES_1 := $(foreach f,%(includes),$(AROS_INCLUDES)/%(path)/$(f))
1808 INCL_FILES_2 := $(foreach f,%(includes),$(GENINCDIR)/%(path)/$(f))
1814 ifneq (%(mmake),includes-copy)
1816 includes-copy : %(mmake)
1819 %(mmake) : $(INCL_FILES_1) $(INCL_FILES_2)
1823 $(AROS_INCLUDES)/%(path)/%.h : $(_INC_PATH)%.h
1826 $(GENINCDIR)/%(path)/%.h : $(_INC_PATH)%.h
1829 $(INCL_FILES_1) : | $(AROS_INCLUDES)/%(path)
1830 $(INCL_FILES_2) : | $(GENINCDIR)/%(path)
1831 GLOB_MKDIRS += $(AROS_INCLUDES)/%(path) $(GENINCDIR)/%(path)
1835 %define make_hidd_stubs hidd=/A cflags=$(CFLAGS) dflags=$(CFLAGS) parenttarget=linklibs
1836 STUBS_SRC := $(foreach f,$(STUBS),$(f).c)
1837 STUBS_OBJ := $(foreach f,$(STUBS),$(OBJDIR)/$(f).o)
1838 STUBS_MEM := $(foreach f,$(STUBS),$(f).o)
1839 STUBS_DEP := $(foreach f,$(STUBS),$(OBJDIR)/$(f).d)
1840 HIDD_LIB := $(AROS_LIB)/libhiddstubs.a
1842 #MM- linklibs : hidd-%(hidd)-stubs
1843 #MM- %(parenttarget): hidd-%(hidd)-stubs
1844 #MM hidd-%(hidd)-stubs : includes includes-copy
1845 hidd-%(hidd)-stubs : setup $(HIDD_LIB)($(STUBS_MEM))
1847 $(HIDD_LIB)($(STUBS_MEM)) : $(STUBS_OBJ)
1850 $(STUBS_OBJ) : $(STUBS_SRC)
1851 %compile_q cmd=$(TARGET_CC) opt=%(cflags)
1853 $(STUBS_DEP) : $(STUBS_SRC)
1854 %mkdepend_q flags=%(dflags)
1857 %mkdirs_q $(OBJDIR) $(LIBDIR)
1861 -@$(RM) $(HIDD_LIB) $(OBJDIR)
1863 DEPS := $(DEPS) $(STUBS_DEP)
1867 #------------------------------------------------------------------------------
1868 # Build an imported source tree which uses the configure script from the
1869 # autoconf package. This rule will try to "integrate" the produced files as
1870 # much as possible in the AROS build, for example by putting libraries in the
1871 # standard library directory, includes in the standard include directory, and
1872 # so on. You can however override this behaviour.
1874 # As a special "bonus" for you, the PROGDIR environment variable is defined to
1875 # be %(bindir) (or its deduced value) when running "make install", and
1876 # "PROGDIR:" when running "make" alone; you can use this feature to pass the
1877 # configure script some more parameters whose value depends upon the PROGDIR
1878 # env var, so that the program gets all its stuff installed in the proper place
1879 # when building it, but when running it from inside AROS it can also find that
1880 # stuff by simply opening PROGDIR:, which it will do automatically if it uses
1881 # the configuration parameters set when running ./configure
1883 # *NOTICE*: DO NOT put a trailing '/' (slash) after $PROGDIR, as the variable
1884 # already contains either a '/' (slash) or a ':' (colon), thus simply attach it
1885 # to the name which has to follow it.
1888 %define build_with_configure mmake=/A srcdir=$(TOP)/$(CURDIR) prefix= \
1889 aros_prefix= extraoptions= nix_dir_layout= nix=no compiler=target \
1890 install_target=install postconfigure= postinstall=
1893 %(mmake)-prefix := %(prefix)
1895 %(mmake)-prefix := $(AROS_CONTRIB)
1898 ifneq (%(aros_prefix),)
1899 %(mmake)-aros_prefix := %(aros_prefix)
1901 %(mmake)-aros_prefix := $(%(mmake)-prefix)
1905 %(mmake)-nix := -nix
1906 %(mmake)-volpfx := /
1907 %(mmake)-volsfx := /
1909 ifeq (%(nix_dir_layout),)
1910 %(mmake)-nix_dir_layout := yes
1913 %(mmake)-volsfx := :
1915 ifeq (%(nix_dir_layout),)
1916 %(mmake)-nix_dir_layout := no
1920 %(mmake)-volfunc = $(%(mmake)-volpfx)$(notdir $1)$(%(mmake)-volsfx)
1922 %(mmake)-install_opts := prefix=$(%(mmake)-prefix) exec_prefix=$(%(mmake)-prefix)
1924 # Check if chosen compiler is valid
1925 ifeq ($(findstring %(compiler),host target kernel),)
1926 $(error unknown compiler %(compiler))
1929 # Set legacy 'host' variable based on chosen compiler
1930 ifeq (%(compiler),host)
1936 ifeq ($(filter yes, $(%(mmake)-nix_dir_layout) %(host)),yes)
1937 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)/bin
1938 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1941 %(mmake)-config_opts := --prefix=/PROGDIR --bindir=/PROGDIR --sbindir=/PROGDIR \
1942 --libdir=/LIB --includedir=/INCLUDE --oldincludedir=/INCLUDE
1944 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1947 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)
1949 %(mmake)-install_opts := bindir=$(%(mmake)-prefix) sbindir=$(%(mmake)-prefix) \
1950 libdir=$(AROS_LIB) includedir=$(AROS_INCLUDES) oldincludedir=$(AROS_INCLUDES)
1954 .PHONY : %(mmake) %(mmake)-clean %(mmake)-build_and_install-quick
1956 #MM- %(mmake) : setup includes linklibs-core %(mmake)-quick
1958 ifneq (%(install_target),)
1959 %(mmake)-install_command = \
1960 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1961 -C $(GENDIR)/$(CURDIR) %(install_target) && \
1962 $(TOUCH) $(GENDIR)/$(CURDIR)/.installed
1964 %(mmake)-uninstall_command = \
1965 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
1966 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1967 -C $(GENDIR)/$(CURDIR) uninstall
1969 %(mmake)-install_command := true
1970 %(mmake)-uninstall_command := true
1973 #MM- %(mmake)-quick : %(mmake)-configure %(postconfigure) %(mmake)-build_and_install-quick %(postinstall)
1976 %(mmake)-build_and_install-quick : $(GENDIR)/$(CURDIR)/.configured
1977 if ! $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -q -C $(GENDIR)/$(CURDIR); then \
1978 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
1979 $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -C $(GENDIR)/$(CURDIR) && \
1980 $(%(mmake)-install_command); \
1983 %(srcdir)/.files-touched:
1984 find %(srcdir) -exec $(TOUCH) -r %(srcdir)/configure '{}' \; && \
1988 %(mmake)-uninstall :
1989 $(%(mmake)-uninstall_command)
1991 ifneq ($(DEBUG),yes)
1992 %(mmake)-s_flag = -s
1996 %(mmake)-configure : $(GENDIR)/$(CURDIR)/.configured
1998 ifeq (%(compiler),host)
1999 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2001 %mkdirs_q $(GENDIR)/$(CURDIR)
2002 cd $(GENDIR)/$(CURDIR) && \
2003 find . -name config.cache -exec $(RM) '{}' \; && \
2005 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) && \
2008 ifeq (%(compiler),target)
2009 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2011 %mkdirs_q $(GENDIR)/$(CURDIR)
2012 cd $(GENDIR)/$(CURDIR) && \
2013 find . -name config.cache -exec $(RM) '{}' \; && \
2014 CC="$(TARGET_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2015 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2016 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2017 --host=$(AROS_TARGET_CPU)-aros \
2018 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2019 --without-x --without-pic --disable-shared && \
2022 ifeq (%(compiler),kernel)
2023 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2025 %mkdirs_q $(GENDIR)/$(CURDIR)
2026 cd $(GENDIR)/$(CURDIR) && \
2027 find . -name config.cache -exec $(RM) '{}' \; && \
2028 CC="$(KERNEL_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2029 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2030 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2031 --host=$(AROS_TARGET_CPU)-aros \
2032 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2033 --without-x --without-pic --disable-shared && \
2038 %(mmake)-clean : %(mmake)-uninstall
2039 @$(RM) $(GENDIR)/$(CURDIR)
2042 #############################################################################
2043 #############################################################################
2045 ## Miscellaneous macros. Everything that doesn't fit above should be put ##
2048 #############################################################################
2049 #############################################################################
2051 #----------------------------------------------------------------------------------
2052 # Given an archive name, patches names and locations where to find them, fetch
2053 # the archive and the patches from any of those locations, unpack the archive
2054 # and then apply the patches.
2056 # Locations currently supported are http and ftp sites, plus local filesystem
2057 # directories. Supported archives are .tar.bz2 and .tar.gz. To modify this,
2058 # the fetch.sh script needs to be modified, since this macro relies on that script.
2062 # - archive_origins = list of locations where to find the archive. They are tried
2063 # in sequence, until the archive is found and fetching it
2064 # succeeded. If not specified, the current directory is assumed.
2065 # - archive = the archive name. Mandatory.
2066 # - destination = the local directory where to put the archive and patches.
2067 # If not specified, the current directory is assumed.
2068 # - patches_origins = list of locations where to find the patches. They are tried
2069 # in sequence, until a patch is found and fetching it
2070 # succeeded. If not specified, the current directory is assumed.
2071 # - patches_specs = list of "patch specs". A patch spec is of the form
2072 # patch_name[:[patch_subdir][:patch_opt]].
2074 # - patch_name = the name of the patch file
2075 # - patch_subdir = the directory within \destination\ where to
2077 # - patch_opt = any options to pass to the `patch' command
2078 # when applying the patch.
2080 # The patch_subdir and patch_opt fields are optional.
2082 %define fetch archive_origins=. archive=/A suffixes= destination=. patches_origins=. patches_specs=::
2083 $(FETCH) -ao "%(archive_origins)" -a %(archive) -as "%(suffixes)" -d %(destination) \
2084 -po "%(patches_origins)" -p %(patches_specs)
2087 #-----------------------------------------------------------------------------------------
2088 # Joins the features of %fetch and %build_with_configure, taking advantage of
2089 # the naming scheme of GNU packages. GNU packages names are in the form
2091 # <package name>-<version number>.<archive format suffix>
2093 # If a patch is provided, it *must* be named the following way:
2095 # <package name>-<version number>-aros.diff
2097 # Moreover, it *must* be appliable with the -p1 option of the `patch' command after
2098 # CD'ing into the archive's extracted directory.
2100 # Note that whilst the %fetch macro accepts a list of patches for any given archive,
2101 # the %fetch_and_build macro only accept *one* patch for each package. It's up to you
2102 # to make that patch fully comprehensive.
2104 # NOTE: GNU packages are always compiled with *nix semantics turned on.
2108 # - mmake = the meta make target, as would be supplied to the %build_with_configure
2110 # - package = the GNU package name, sans version and archive format suffixes.
2111 # - version = the package's version number, or otherwise any other version string.
2112 # It gets appended to the package name to form the basename of the archive.
2113 # - suffixes = a list of suffixes to apped to the the package name plus the
2114 # version. Each one of them is tried until a matching archive is found.
2115 # Defaults to "tat.bz2 tar.gz".
2116 # - destination = same meaning as the one for the %fetch macro
2117 # - package_repo = same meaning as the one of the %fetch macro's %(archive_origins) argument
2118 # - patch = "yes" or "no", depending on whether a patch for this package needs to be
2120 # - patch_repo = same meaning as the one of the %fetch macro's %(patches_origins) argument
2121 # - prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2123 # - aros_prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2125 # - extraoptions = same meaning as the one for the %build_with_configure macro.
2126 # - postinstall = same meaning as the one for the %build_with_configure macro.
2128 %define fetch_and_build mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2129 srcdir= package_repo= patch=no patch_repo= prefix= \
2130 aros_prefix= extraoptions= postconfigure= postinstall= nix=no nix_dir_layout=
2132 #MM- %(mmake)-quick : %(mmake)-%(subpackage)-quick
2133 #MM- %(mmake)-%(subpackage)-quick : %(mmake)-%(subpackage)-fetch
2135 %(mmake)-archbase := %(package)-%(version)
2138 %(mmake)-prefix := $(CONTRIB_DIR)/%(package)
2140 %(mmake)-prefix := %(prefix)
2143 ifneq (%(subpackage),)
2144 %(mmake)-%(subpackage)-archbase := %(package)-%(subpackage)-%(version)
2146 %(mmake)-%(subpackage)-archbase := %(package)-%(version)
2150 %(mmake)-%(subpackage)-srcdir := %(srcdir)
2152 %(mmake)-%(subpackage)-srcdir := $(%(mmake)-archbase)
2156 %(mmake)-%(subpackage)-patches_specs := $(%(mmake)-%(subpackage)-archbase)-aros.diff:$(%(mmake)-%(subpackage)-srcdir):-p1
2158 %(mmake)-%(subpackage)-patches_specs := ::
2161 #MM- %(mmake)-fetch : %(mmake)-%(subpackage)-fetch
2163 .PHONY : %(mmake)-%(subpackage)-fetch
2165 %(mmake)-%(subpackage)-fetch :
2166 %fetch archive=$(%(mmake)-%(subpackage)-archbase) suffixes="%(suffixes)" \
2167 destination=$(PORTSDIR)/%(package) \
2168 archive_origins=". %(package_repo)" \
2169 patches_specs="$(%(mmake)-%(subpackage)-patches_specs)" patches_origins=". %(patch_repo)"
2171 #MM- %(mmake) : %(mmake)-%(subpackage)
2173 PACKAGES_DIR := $(AROSDIR)/../Packages
2175 %(mmake)-%(subpackage)-package-dir := $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)
2177 %(mmake)-%(subpackage)-package-basename := \
2178 $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)-aros.$(AROS_TARGET_CPU)
2180 %build_with_configure mmake=%(mmake)-%(subpackage) \
2181 srcdir=$(PORTSDIR)/%(package)/$(%(mmake)-%(subpackage)-srcdir) \
2182 nix=%(nix) nix_dir_layout=%(nix_dir_layout) prefix="$(%(mmake)-%(subpackage)-package-dir)" \
2183 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall) \
2184 %(mmake)-%(subpackage)-make-package" extraoptions="%(extraoptions)"
2186 .PHONY : %(mmake)-%(subpackage)-make-package
2187 #MM %(mmake)-%(subpackage)-make-package : %(mmake)-%(subpackage)-quick
2190 %(mmake)-%(subpackage)-make-package : $(%(mmake)-%(subpackage)-package-basename).tar.bz2
2192 #There seems to be a bug, either with my clock or with make, 'cause it may happen
2193 #that $^ and $@ have exactly the same mtime, and in that case make tries
2194 #to rebuild $@ again, which would fail because the directory where
2195 #the package got installed would not exist anymore.
2196 #We work this around by using an if statement to manually check the mtimes.
2197 $(%(mmake)-%(subpackage)-package-basename).tar.bz2 :
2198 @if test $(GENDIR)/$(CURDIR)/.installed -nt $@ || ! test -f $@; then \
2200 $(ECHO) "Building \`$(%(mmake)-%(subpackage)-package-basename).tar.bz2'" && \
2201 cd $(%(mmake)-%(subpackage)-package-dir) && \
2202 tar --remove-files -cvf $(%(mmake)-%(subpackage)-package-basename).tar * && \
2203 mkdir -p "$(%(mmake)-prefix)" && \
2204 tar -xf $(%(mmake)-%(subpackage)-package-basename).tar -C "%(prefix)"/ && \
2205 bzip2 -9 -f $(%(mmake)-%(subpackage)-package-basename).tar && \
2206 cd .. && $(RM) $(%(mmake)-%(subpackage)-archbase); \
2210 %define fetch_and_build_gnu mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2211 srcdir= package_repo= patch=no patch_repo= prefix=$(GNUDIR) \
2212 aros_prefix=/GNU extraoptions= postconfigure= postinstall=
2214 GNU_REPOSITORY := http://ftp.gnu.org/pub/gnu
2216 %fetch_and_build mmake="%(mmake)" package="%(package)" subpackage="%(subpackage)" version="%(version)" \
2217 suffixes="%(suffixes)" srcdir="%(srcdir)" \
2218 package_repo="%(package_repo) $(GNU_REPOSITORY)/%(package)" \
2219 patch="%(patch)" patch_repo="%(patch_repo)" \
2220 prefix="%(prefix)" aros_prefix="%(aros_prefix)" extraoptions="%(extraoptions)" \
2221 postconfigure="%(postconfigure)" postinstall="%(postinstall)" nix=yes
2225 #-----------------------------------------------------------------------------------------
2226 # Same job as the one of %fetch_and_build_gnu, except that this one assumes
2227 # that the package is a "Development" package, and as such it needs to be placed
2228 # under the $(AROS_DEVELOPMENT) directory, as a default.
2230 # All the arguments have the same meaning as the ones of the %fetch_and_build_gnu
2231 # macro, but notice that %fetch_and_build_gnu_development *doesn't* have a
2232 # "mmake" argument, because the metatarget is implicitely defined as
2234 # #MM- development-%(package)
2236 %define fetch_and_build_gnu_development package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2237 srcdir= package_repo= patch=no patch_repo= prefix=$(AROS_DEVELOPMENT) \
2238 aros_prefix=/Development postconfigure= postinstall= extraoptions=
2240 #MM- development : development-%(package)
2243 %fetch_and_build_gnu mmake=development-%(package) package=%(package) subpackage="%(subpackage)" \
2244 version=%(version) suffixes="%(suffixes)" srcdir="%(srcdir)" \
2245 package_repo="%(package_repo)" patch="%(patch)" patch_repo="%(patch_repo)" prefix=%(prefix) \
2246 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall)" \
2247 extraoptions="%(extraoptions)"