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 nix=no
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)
296 $(TMP_TARGETBASE).o : CFLAGS := -nix %(cflags)
298 $(TMP_TARGETBASE).o : CFLAGS := %(cflags)
300 $(TMP_TARGETBASE).o : %(basename).c
301 %compile_q cmd=$(TMP_CMD)
305 $(TMP_TARGETBASE).d : TMP_DFLAGS:=-nix %(cflags)
307 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(cflags)
311 $(TMP_TARGETBASE).d : TMP_DFLAGS:=-nix %(dflags)
313 $(TMP_TARGETBASE).d : TMP_DFLAGS:=%(dflags)
316 $(TMP_TARGETBASE).d : %(basename).c
317 %mkdepend_q cc=$(TMP_CMD) flags=$(TMP_DFLAGS)
319 #------------------------------------------------------------------------------
322 #------------------------------------------------------------------------------
323 # Generate a rule to compile multiple C source files to an object file and
324 # generate the corresponding dependency files. The generated file will be put
325 # in the object directory without the directory part of the source file.
327 # - basenames: the basenames of the files to compile. The names may include
328 # relative or absolute path names. No wildcard is allowed
329 # - cflags (default $(CFLAGS)): the C flags to use for compilation
330 # - dflags: the flags used during creation of dependency file. If not specified
331 # the same value as cflags will be used
332 # - targetdir: the directory to put the .o file and the .d file. By default
333 # it is put in the same directory as the .c file. When targetdir is not
334 # empty, path names will be stripped from the file names so that all files
335 # are in that dir and not in subdirectories.
336 # - compiler (default target): compiler to use, either target or host
337 %define rule_compile_multi basenames=/A cflags=$(CFLAGS) dflags= targetdir= \
341 TMP_TARGETS := $(addsuffix .o,%(basenames))
342 TMP_DTARGETS := $(addsuffix .d,%(basenames))
345 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
346 TMP_DTARGETS := $(addsuffix .d,$(addprefix %(targetdir)/,$(notdir %(basenames))))
347 TMP_WILDCARD := %(targetdir)/%
349 # Be sure that all .c files are generated
350 $(TMP_TARGETS) $(TMP_DTARGETS) : | $(addsuffix .c,%(basenames))
352 # Be sure that all .c files are found
353 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
355 vpath %.c $(TMP_DIRS)
360 ifeq ($(findstring %(compiler),host target),)
361 $(error unknown compiler %(compiler))
363 ifeq (%(compiler),target)
364 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(TARGET_CC)
366 ifeq (%(compiler),host)
367 $(TMP_TARGETS) $(TMP_DTARGETS) : CMD:=$(HOST_CC)
370 $(TMP_TARGETS) : CFLAGS := %(cflags)
371 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %.c
372 %compile_q cmd=$(CMD)
375 $(TMP_DTARGETS) : DFLAGS:=%(cflags)
377 $(TMP_DTARGETS) : DFLAGS:=%(dflags)
379 $(TMP_DTARGETS) : $(TMP_WILDCARD).d : %.c
380 %mkdepend_q cc=$(CMD) flags=$(DFLAGS)
382 #------------------------------------------------------------------------------
385 #------------------------------------------------------------------------------
386 # Make an alias from one arch specific build to another arch.
388 # - mainmmake: the mmake of the module in the main tree
389 # - arch: the current arch
390 # - alias: the alias to which this should point
391 %define rule_archalias mainmmake=\A arch=\A alias=\A
393 #MM- %(mainmmake)-%(arch) : %(mainmmake)-%(alias)
395 #------------------------------------------------------------------------------
398 #------------------------------------------------------------------------------
399 # Generate a rule to compile a C source file to a shared object file with a
400 # .so suffix. Basename may contain a directory part, then the source
401 # file has to be in that directory. The generated file will be put in the
402 # object directory without the directory.
404 # - basename: the basename of the file to compile. Use % for a wildcard rule
405 # - cflags (default $(CFLAGS)): the C flags to use for compilation
406 # - targetdir: the directory to put the .o file and the .d file. By default
407 # it is put in the same directory as the .c file
408 %define rule_compile_shared basename=/A cflags=$(CFLAGS) targetdir= compiler=target
411 TMP_TARGETBASE := %(basename)
413 TMP_TARGETBASE := %(targetdir)/$(notdir %(basename))
416 ifeq ($(findstring %(compiler),host target),)
417 $(error unknown compiler %(compiler))
419 ifeq (%(compiler),target)
420 $(TMP_TARGETBASE).so : TMP_CMD:=$(TARGET_CC)
422 ifeq (%(compiler),host)
423 $(TMP_TARGETBASE).so : TMP_CMD:=$(HOST_CC)
426 $(TMP_TARGETBASE).so : %(basename).c
427 %compile_q opt="$(SHARED_CFLAGS) %(cflags)" cmd=$(TMP_CMD)
429 #------------------------------------------------------------------------------
432 #------------------------------------------------------------------------------
433 # Generate a rule to assemble a source file to an object file. Basename may
434 # contain a directory part, then the source file has to be in that directory.
435 # The generated file will be put in the object directory without the directory.
437 # - basename: the basename of the file to compile. Use % for a wildcard rule
438 # - flags (default $(AFLAGS)): the asm flags to use for assembling
439 # - targetdir: the directory to put the .o file in. By default it is put in the
440 # same directory as the .s file
441 %define rule_assemble basename=/A aflags=$(AFLAGS) targetdir=
444 %(basename).o : AFLAGS := %(aflags)
445 %(basename).o : %(basename).s
449 %(targetdir)/$(notdir %(basename)).o : AFLAGS := %(aflags)
450 %(targetdir)/$(notdir %(basename)).o : %(basename).s
455 #------------------------------------------------------------------------------
458 #------------------------------------------------------------------------------
459 # Generate a rule to assemble multiple source files to an object file. The
460 # generated file will be put in the object directory with the directory part
461 # of the source file stripped off.
463 # - basenames: the basenames of the files to compile. The names may include
464 # relative or absolute path names. No wildcard is allowed
465 # - aflags (default $(AFLAGS)): the flags to use for assembly
466 # - targetdir: the directory to put the .o file and the .d file. By default
467 # it is put in the same directory as the .c file. When targetdir is not
468 # empty, path names will be stripped from the file names so that all files
469 # are in that dir and not in subdirectories.
470 %define rule_assemble_multi basenames=/A aflags=$(AFLAGS) targetdir= suffix=.s
473 TMP_TARGETS := $(addsuffix .o,%(basenames))
476 TMP_TARGETS := $(addsuffix .o,$(addprefix %(targetdir)/,$(notdir %(basenames))))
477 TMP_WILDCARD := %(targetdir)/%
479 # Be sure that all .s files are generated
480 $(TMP_TARGETS) : | $(addsuffix %(suffix),%(basenames))
482 # Be sure that all .c files are found
483 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
485 vpath %%(suffix) $(TMP_DIRS)
490 $(TMP_TARGETS) : AFLAGS := %(aflags)
491 $(TMP_TARGETS) : $(TMP_WILDCARD).o : %%(suffix)
492 %assemble_q opt=$(AFLAGS)
494 #------------------------------------------------------------------------------
497 #------------------------------------------------------------------------------
498 # Link %(objs) to %(prog) using the libraries in %(uselibs)
499 %define rule_link_prog prog=/A objs=/A ldflags=$(LDFLAGS) uselibs= \
500 usehostlibs= usestartup=yes detach=no nix=no
504 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
506 ifeq (%(usestartup),no)
507 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
510 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
512 %(prog) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
514 %(prog) : %(objs) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
515 %link_q from="%(objs)" opt="%(ldflags) $(EXTRA_LDFLAGS)" \
516 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
518 #------------------------------------------------------------------------------
521 #------------------------------------------------------------------------------
522 # Link %(progs) from object in %(objdir) to executables in %(targetdir) using
523 # the AROS libraries in %(uselibs) and the host libraries in %(usehostlibs)
524 %define rule_link_progs progs=/A targetdir=$(AROSDIR)/$(CURDIR) nix=%(nix) \
525 objdir=$(GENDIR)/$(CURDIR) ldflags=$(LDFLAGS) uselibs= usehostlibs= \
526 usestartup=yes detach=no
530 TMP_EXTRA_LDFLAGS += $(NIX_LDFLAGS)
532 ifeq (%(usestartup),no)
533 TMP_EXTRA_LDFLAGS += $(NOSTARTUP_LDFLAGS)
536 TMP_EXTRA_LDFLAGS += $(DETACH_LDFLAGS)
538 $(addprefix %(targetdir)/,%(progs)) : EXTRA_LDFLAGS:=$(TMP_EXTRA_LDFLAGS)
540 $(addprefix %(targetdir)/,%(progs)) : %(targetdir)/% : %(objdir)/%.o \
541 $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
542 %link_q from=$< opt="%(ldflags) $(EXTRA_LDFLAGS)" \
543 libs="$(addprefix -l,%(uselibs)) $(addprefix -l,%(usehostlibs))"
545 #------------------------------------------------------------------------------
548 #------------------------------------------------------------------------------
549 # Link the %(objs) to the library %(libdir)/lib%(libname).a in
550 %define rule_link_linklib libname=/A objs=/A libdir=$(LIBDIR)
552 %(libdir)/lib%(libname).a : %(objs)
555 #------------------------------------------------------------------------------
558 #------------------------------------------------------------------------------
559 # Link the %(objs) to the library %(libdir)/lib%(libname).so in
560 %define rule_link_shlib libname=/A objs=/A libdir=$(LIBDIR)
562 %(libdir)/lib%(libname).so : %(objs)
563 @$(SHARED_LD) $(SHARED_LDFLAGS) -o $@ $^
565 #------------------------------------------------------------------------------
568 #------------------------------------------------------------------------------
569 # Link the %(objs) and %(endobj) to %(module) with errors in %(err) and using
570 # the libraries in %(uselibs) and the host libraries in %(usehostlibs)
571 %define rule_linkmodule module=/A objs=/A endobj=/A err=/A objdir=$(OBJDIR) \
572 uselibs= usehostlibs=
574 %(module) : OBJS := %(objs)
575 %(module) : ENDTAG := %(endobj)
576 %(module) : ERR := %(err)
577 %(module) : OBJDIR := %(objdir)
578 %(module) : LIBS := $(addprefix -l,%(uselibs)) -lautoinit -llibinit -L/usr/lib $(addprefix -l,%(usehostlibs))
579 %(module) : %(objs) %(endobj) $(addprefix $(LIBDIR)/lib,$(addsuffix .a,%(uselibs) libinit autoinit))
580 %link_module_q err=$(ERR) endtag=$(ENDTAG) objs=$(OBJS) libs=$(LIBS) objdir=$(OBJDIR)
583 #------------------------------------------------------------------------------
586 #------------------------------------------------------------------------------
587 # Generate a rule to generate a function reference file from a C source file.
588 # Basename may contain a directory part, then the source file has to be in that
589 # directory. The generated file will be put in the object directory without the
592 # - basename: the basename of the file to compile. Use % for a wildcard rule
593 # - cflags (default $(CFLAGS)): the C flags to use for compilation
594 # - targetdir: the directory to put the generated .ref file. By default the
595 # .ref file will be put in the same directory as the .c file.
596 # - includefile: This file will be included at the head of the source file
597 %define rule_ref basename=/A cflags=$(CFLAGS) targetdir= includefile= compiler=target
600 GENFILE_TMP := %(basename).ref
602 GENFILE_TMP := %(targetdir)/$(notdir %(basename)).ref
605 ifeq ($(filter %(compiler),target host),)
606 $(error use of %rule_ref: compiler has to be 'host' or 'target')
609 ifeq (%(compiler),target)
610 $(GENFILE_TMP) : CC:=$(TARGET_CC)
612 $(GENFILE_TMP) : CC:=$(HOST_CC)
615 $(GENFILE_TMP) : %(basename).c $(CXREF) %(includefile)
616 ifeq (%(includefile),)
617 %mkref_q cc=$(CC) cflags="%(cflags)"
619 %mkref_q cc=$(CC) cflags="%(cflags) -include %(includefile)"
623 #------------------------------------------------------------------------------
626 #------------------------------------------------------------------------------
627 # Generate a rule to generate a function reference file from a C source file.
628 # Basename may contain a directory part, then the source file has to be in that
629 # directory. The generated file will be put in the object directory without the
632 # - basenames: the basenames of the files to compile. No wildcard is allowed
633 # - cflags (default $(CFLAGS)): the C flags to use for compilation
634 # - targetdir: the directory to put the generated .ref file. By default the
635 # .ref file will be put in the same directory as the .c file. When targetdir
636 # is not empty all files will be put there and path parts in the basenames
637 # will be stripped off.
638 # - includefile: This file will be included at the head of the source file
639 %define rule_ref_multi basenames=/A cflags=$(CFLAGS) targetdir= includefile= \
643 TMP_TARGETS := $(addsuffix .ref,%(basenames))
644 TMP_WILDCARD := %.ref
646 TMP_TARGETS := $(addprefix %(targetdir)/,$(addsuffix .ref,$(notdir %(basenames))))
647 TMP_WILDCARD := %(targetdir)/%.ref
649 # Be sure that all .c files are generated
650 $(TMP_TARGETS) : | $(addsuffix .c,%(basenames))
652 # Be sure that all .c files are found
653 TMP_DIRS := $(filter-out ./,$(sort $(dir %(basenames))))
655 vpath %.c $(TMP_DIRS)
660 ifeq ($(filter %(compiler),target host),)
661 $(error use of %rule_ref: compiler has to be 'host' or 'target')
664 ifeq (%(compiler),target)
665 $(TMP_TARGETS) : CC:=$(TARGET_CC)
667 $(TMP_TARGETS) : CC:=$(HOST_CC)
669 ifeq (%(includefile),)
670 $(TMP_TARGETS) : CFLAGS:=%(cflags)
672 $(TMP_TARGETS) : CFLAGS:="%(cflags) -include %(includefile)"
673 $(TMP_TARGETS) : %(includefile)
675 $(TMP_TARGETS) : $(CXREF)
676 $(TMP_TARGETS) : $(TMP_WILDCARD) : %.c
679 #------------------------------------------------------------------------------
682 #------------------------------------------------------------------------------
683 # Generate the libdefs.h include file for a module.
684 %define rule_genmodule_genlibdefs modname=/A modtype=/A modsuffix= conffile= targetdir=
686 TMP_TARGET := %(modname)_libdefs.h
687 TMP_DEPS := $(GENMODULE)
690 TMP_OPTS += -c %(conffile)
691 TMP_DEPS += %(conffile)
693 TMP_DEPS += %(modname).conf
695 ifneq (%(modsuffix),)
696 TMP_OPTS += -s %(modsuffix)
698 ifneq (%(targetdir),)
699 TMP_OPTS += -d %(targetdir)
700 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
703 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
704 $(TMP_TARGET) : MODNAME := %(modname)
705 $(TMP_TARGET) : MODTYPE := %(modtype)
706 $(TMP_TARGET) : $(TMP_DEPS)
707 @$(ECHO) "Generating $(notdir $@)"
708 @$(GENMODULE) $(OPTS) writelibdefs $(MODNAME) $(MODTYPE)
710 #------------------------------------------------------------------------------
713 #------------------------------------------------------------------------------
714 # Generate the libdefs.h include file for a module.
715 %define rule_genmodule_funclist \
716 modname=/A modtype=/A modsuffix= conffile= targetdir= reffile=
718 TMP_TARGET := %(modname).funclist
719 TMP_DEPS := $(GENMODULE)
722 $(error reffile needed in rule_genmodule_funclist but none specified)
724 TMP_OPTS := -r %(reffile)
725 TMP_DEPS += %(reffile)
727 TMP_OPTS += -c %(conffile)
728 TMP_DEPS += %(conffile)
730 TMP_DEPS += %(modname).conf
732 ifneq (%(modsuffix),)
733 TMP_OPTS += -s %(modsuffix)
735 ifneq (%(targetdir),)
736 TMP_OPTS += -d %(targetdir)
737 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
740 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
741 $(TMP_TARGET) : MODNAME := %(modname)
742 $(TMP_TARGET) : MODTYPE := %(modtype)
743 $(TMP_TARGET) : $(TMP_DEPS)
744 @$(ECHO) "Generating $(notdir $@)"
745 @$(GENMODULE) $(OPTS) writefunclist $(MODNAME) $(MODTYPE)
747 #------------------------------------------------------------------------------
750 #------------------------------------------------------------------------------
751 # Generate a Makefile.%(modname) with the genmodule program and include this
752 # generated file in this Makefile
753 %define rule_genmodule_makefile modname=/A modtype=/A modsuffix= conffile= \
756 TMP_TARGET := Makefile.%(modname)
757 TMP_DEPS := $(GENMODULE)
760 TMP_OPTS += -c %(conffile)
761 TMP_DEPS += %(conffile)
763 TMP_DEPS += %(modname).conf
765 ifneq (%(modsuffix),)
766 TMP_OPTS += -s %(modsuffix)
768 ifneq (%(targetdir),)
769 TMP_OPTS += -d %(targetdir)
770 TMP_TARGET := %(targetdir)/$(TMP_TARGET)
773 $(TMP_TARGET) : OPTS := $(TMP_OPTS)
774 $(TMP_TARGET) : MODNAME := %(modname)
775 $(TMP_TARGET) : MODTYPE := %(modtype)
776 $(TMP_TARGET) : $(TMP_DEPS)
777 @$(GENMODULE) $(OPTS) writemakefile $(MODNAME) $(MODTYPE)
779 #------------------------------------------------------------------------------
781 #------------------------------------------------------------------------------
782 # Generate dummy support files so cxref when used on the a module source file
783 # will find something to include. This rule has to be preceeded by
784 # %rule_genmodule_makefile
785 %define rule_genmodule_dummy modname=/A modtype=/A modsuffix= conffile= targetdir=
787 ifneq ($(%(modname)_INCLUDES),)
788 TMP_TARGETS := $(%(modname)_INCLUDES)
790 TMP_DEPS := $(GENMODULE)
793 TMP_OPTS += -c %(conffile)
794 TMP_DEPS += %(conffile)
796 TMP_DEPS += %(modname).conf
798 ifneq (%(modsuffix),)
799 TMP_OPTS += -s %(modsuffix)
801 ifneq (%(targetdir),)
802 TMP_OPTS += -d %(targetdir)
803 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
806 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
807 $(TMP_TARGETS) : MODNAME := %(modname)
808 $(TMP_TARGETS) : MODTYPE := %(modtype)
809 $(TMP_TARGETS) : $(TMP_DEPS)
810 @$(ECHO) "Generating dummy include files"
811 @$(GENMODULE) $(OPTS) writedummy $(MODNAME) $(MODTYPE)
814 #------------------------------------------------------------------------------
817 #------------------------------------------------------------------------------
818 # Generate the support files for compiling a module. This includes include
819 # files and source files. This rule has to be preceeded by
820 # %rule_genmodule_makefile
821 %define rule_genmodule_files modname=/A modtype=/A modsuffix= targetdir= \
824 TMP_TARGETS := $(%(modname)_STARTFILES) $(%(modname)_ENDFILES) \
825 $(%(modname)_LINKLIBFILES)
826 TMP_TARGETS := $(addsuffix .c,$(TMP_TARGETS)) $(addsuffix .S, $(%(modname)_LINKLIBAFILES))
828 TMP_DEPS := $(GENMODULE)
829 ifeq ($(%(modname)_NEEDREF), yes)
831 $(error reffile needed in rule_genmodule_files but none specified)
833 TMP_OPTS := -r %(reffile)
834 TMP_DEPS += %(reffile)
839 TMP_OPTS += -c %(conffile)
840 TMP_DEPS += %(conffile)
842 TMP_DEPS += %(modname).conf
844 ifneq (%(modsuffix),)
845 TMP_OPTS += -s %(modsuffix)
847 ifneq (%(targetdir),)
848 TMP_OPTS += -d %(targetdir)
849 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
852 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
853 $(TMP_TARGETS) : MODNAME := %(modname)
854 $(TMP_TARGETS) : MODTYPE := %(modtype)
855 $(TMP_TARGETS) : $(TMP_DEPS)
856 @$(ECHO) "Generating functable and support files for module $(BD_MODNAME$(BDID))"
857 ifneq (%(conffile),lib.conf)
858 @$(IF) $(TEST) -f lib.conf; then \
859 $(ECHO) "WARNING !!! $(CURDIR)/lib.conf may probably be removed"; \
862 @$(IF) $(TEST) -f libdefs.h; then \
863 $(ECHO) "WARNING !!! $(CURDIR)/libdefs.h may probably be removed"; \
865 @$(GENMODULE) $(OPTS) writefiles $(MODNAME) $(MODTYPE)
867 #------------------------------------------------------------------------------
869 #------------------------------------------------------------------------------
870 # Generate the support files for compiling a module. This includes include
871 # files and source files.
872 %define rule_genmodule_includes modname=/A modtype=/A modsuffix= \
873 targetdir= conffile= reffile=
876 ifneq ($(%(modname)_INCLUDES),)
877 TMP_TARGETS := $(%(modname)_INCLUDES)
879 TMP_DEPS := $(GENMODULE)
880 ifeq ($(%(modname)_NEEDREF), yes)
882 $(error reffile needed in rule_genmodule_files but none specified)
884 TMP_OPTS := -r %(reffile)
885 TMP_DEPS += %(reffile)
890 TMP_OPTS += -c %(conffile)
891 TMP_DEPS += %(conffile)
893 TMP_DEPS += %(modname).conf
895 ifneq (%(modsuffix),)
896 TMP_OPTS += -s %(modsuffix)
898 ifneq (%(targetdir),)
899 TMP_OPTS += -d %(targetdir)
900 TMP_TARGETS := $(addprefix %(targetdir)/,$(TMP_TARGETS))
903 $(TMP_TARGETS) : OPTS := $(TMP_OPTS)
904 $(TMP_TARGETS) : MODNAME := %(modname)
905 $(TMP_TARGETS) : MODTYPE := %(modtype)
906 $(TMP_TARGETS) : $(TMP_DEPS)
907 @$(ECHO) "Generating include files"
908 @$(GENMODULE) $(OPTS) writeincludes $(MODNAME) $(MODTYPE)
911 #------------------------------------------------------------------------------
913 #------------------------------------------------------------------------------
914 # Common rules for all makefiles
916 # Delete generated makefiles
919 @$(RM) $(TOP)/$(CURDIR)/mmakefile $(TOP)/$(CURDIR)/mmakefile.bak
921 include $(TOP)/config/make.tail
923 BDID := $(BDTARGETID)
925 #------------------------------------------------------------------------------
928 #############################################################################
929 #############################################################################
931 ## Here are the mmakefile build macro's. These are macro's that takes care ##
932 ## of everything to go from the sources to the generated target. Also all ##
933 ## intermediate files and directories that are needed are created by these ##
936 #############################################################################
937 #############################################################################
939 #------------------------------------------------------------------------------
941 %define build_prog mmake=/A progname=/A files=$(BD_PROGNAME$(BDID)) asmfiles= \
942 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
943 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
944 aflags=$(AFLAGS) uselibs= usehostlibs= usestartup=yes detach=no nix=no
948 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
950 BD_PROGNAME$(BDID) := %(progname)
951 BD_OBJDIR$(BDID) := %(objdir)
952 BD_TARGETDIR$(BDID) := %(targetdir)
954 BD_FILES$(BDID) := %(files)
955 BD_ASMFILES$(BDID) := %(asmfiles)
956 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID)) $(BD_ASMFILES$(BDID))))
957 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
959 BD_CFLAGS$(BDID) := %(cflags)
960 BD_AFLAGS$(BDID) := %(aflags)
961 BD_DFLAGS$(BDID) := %(dflags)
962 BD_LDFLAGS$(BDID) := %(ldflags)
965 %(mmake)-quick : %(mmake)
967 #MM %(mmake) : includes-generate-deps
968 %(mmake) : $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID))
970 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
971 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) \
972 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
973 %rule_assemble_multi basenames=$(BD_ASMFILES$(BDID)) targetdir=$(BD_OBJDIR$(BDID)) \
974 aflags=$(BD_AFLAGS$(BDID))
976 %rule_link_prog prog=$(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) \
977 objs=$(BD_OBJS$(BDID)) ldflags=$(BD_LDFLAGS$(BDID)) \
978 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
979 usestartup="%(usestartup)" detach="%(detach)" nix="%(nix)"
983 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
985 $(BD_OBJS$(BDID)) $(BD_DEPS$(BDID)) : | $(BD_OBJDIR$(BDID))
986 $(BD_TARGETDIR$(BDID))/$(BD_PROGNAME$(BDID)) : | $(BD_TARGETDIR$(BDID))
987 GLOB_MKDIRS += $(BD_OBJDIR$(BDID)) $(BD_TARGETDIR$(BDID))
990 #------------------------------------------------------------------------------
993 #------------------------------------------------------------------------------
994 # Build programs, for every C file an executable will be built with the same
996 %define build_progs mmake=/A files=/A nix=no \
997 objdir=$(GENDIR)/$(CURDIR) targetdir=$(AROSDIR)/$(CURDIR) \
998 cflags=$(CFLAGS) dflags=$(BD_CFLAGS$(BDID)) ldflags=$(LDFLAGS) \
999 uselibs= usehostlibs= usestartup=yes detach=no
1003 %buildid targets="%(mmake) %(mmake)-clean %(mmake)-quick"
1005 BD_OBJDIR$(BDID) := %(objdir)
1006 BD_TARGETDIR$(BDID) := %(targetdir)
1008 BD_FILES$(BDID) := %(files)
1009 BD_OBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
1010 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(BD_FILES$(BDID))))
1011 BD_EXES$(BDID) := $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID)))
1013 BD_CFLAGS$(BDID) := %(cflags)
1014 ifneq ($(strip $(filter arosc_shared,%(uselibs))),)
1015 BD_CFLAGS$(BDID) += -D_CLIB_LIBRARY_ -I$(TOP)/rom/exec
1017 BD_DFLAGS$(BDID) := %(dflags)
1018 BD_LDFLAGS$(BDID) := %(ldflags)
1021 %(mmake)-quick : %(mmake)
1023 #MM %(mmake) : includes-generate-deps
1024 %(mmake) : $(BD_EXES$(BDID))
1026 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-quick),)
1027 %rule_compile basename=% targetdir=$(BD_OBJDIR$(BDID)) nix=%(nix) \
1028 cflags=$(BD_CFLAGS$(BDID)) dflags=$(BD_DFLAGS$(BDID))
1030 %rule_link_progs progs=$(BD_FILES$(BDID)) nix=%(nix) \
1031 targetdir=$(BD_TARGETDIR$(BDID)) objdir=$(BD_OBJDIR$(BDID)) \
1032 ldflags=$(BD_LDFLAGS$(BDID)) \
1033 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)" \
1034 usestartup="%(usestartup)" detach="%(detach)"
1038 %include_deps depstargets="%(mmake) %(mmake)-quick" deps=$(BD_DEPS$(BDID))
1040 $(addprefix $(BD_TARGETDIR$(BDID))/,$(BD_FILES$(BDID))) : | $(BD_TARGETDIR$(BDID))
1041 $(BD_DEPS$(BDID)) $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1042 GLOB_MKDIRS += $(BD_TARGETDIR$(BDID)) $(BD_OBJDIR$(BDID))
1045 #------------------------------------------------------------------------------
1048 #------------------------------------------------------------------------------
1050 # This is a bare version: It just compiles and links the given files. It is
1051 # assumed that all needed boiler plate code is in the files. This should only
1052 # be used for compiling external code. For AROS code use %build_module
1053 %define build_module_simple mmake=/A modname=/A modtype=/A \
1054 files="$(basename $(wildcard *.c))" \
1055 cflags=$(CFLAGS) dflags=$(BD_DEFDFLASGS) \
1056 objdir=$(OBJDIR) moduledir= \
1057 uselibs= usehostlibs= compiler=target
1059 # Define metamake targets and their dependencies
1060 #MM %(mmake) : core-linklibs includes-generate-deps
1061 #MM %(mmake)-kobj : core-linklibs includes-generate-deps
1065 BD_ALLTARGETS := %(mmake) %(mmake)-clean %(mmake)-quick %(mmake)-kobj
1067 .PHONY : $(BD_ALLTARGETS)
1070 $(error using %build_module_simple: modname may not be empty)
1073 $(error using %build_module_simple: $(MODTYPE) has to be defined with the type of the module)
1076 # Default values for variables and arguments
1077 BD_DEFLINKLIBNAME := %(modname)
1078 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1079 BD_DEFDFLAGS := %(cflags)
1080 OBJDIR ?= $(GENDIR)/$(CURDIR)
1081 BD_MODDIR := %(moduledir)
1082 ifeq ($(BD_MODDIR),)
1083 ifeq (%(modtype),library)
1084 BD_MODDIR := $(AROS_LIBS)
1086 ifeq (%(modtype),gadget)
1087 BD_MODDIR := $(AROS_GADGETS)
1089 ifeq (%(modtype),datatype)
1090 BD_MODDIR := $(AROS_DATATYPES)
1092 ifeq (%(modtype),handler)
1093 BD_MODDIR := $(AROS_FS)
1095 ifeq (%(modtype),device)
1096 BD_MODDIR := $(AROS_DEVS)
1098 ifeq (%(modtype),resource)
1099 BD_MODDIR := $(AROS_RESOURCES)
1101 ifeq (%(modtype),mui)
1102 BD_MODDIR := $(AROS_CLASSES)/Zune
1104 ifeq (%(modtype),mcc)
1105 BD_MODDIR := $(AROS_CLASSES)/Zune
1107 ifeq (%(modtype),mcp)
1108 BD_MODDIR := $(AROS_CLASSES)/Zune
1110 ifeq (%(modtype),hidd)
1111 BD_MODDIR := $(AROS_DRIVERS)
1114 ifeq ($(BD_MODDIR),)
1115 $(error Don't where to put the file for modtype %(modtype). Specify moduledir=)
1118 %rule_compile_multi \
1119 basenames="%(files)" targetdir="%(objdir)" \
1120 cflags="%(cflags)" dflags="%(dflags)" \
1121 compiler=%(compiler)
1123 BD_MODULE := $(BD_MODDIR)/%(modname).%(modtype)
1124 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1126 %(mmake)-quick : %(mmake)
1127 %(mmake) : $(BD_MODULE)
1128 %(mmake)-kobj : $(BD_KOBJ)
1130 # The module is linked from all the compiled .o files
1131 BD_OBJS := $(addprefix %(objdir)/, $(addsuffix .o,%(files)))
1132 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1133 endobj= err=%(modname).err objdir=%(objdir) \
1134 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1136 # Link kernel object file
1137 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1139 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1140 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1141 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1142 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1143 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1144 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1145 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1146 @$(ECHO) "Linking $@"
1147 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1148 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1151 ## Dependency fine-tuning
1153 BD_DEPS := $(addprefix %(objdir), $(addsuffix .o,%(files)))
1154 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1156 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1157 $(BD_MODULE) : | $(BD_MODDIR)
1158 $(BD_KOBJ) : | $(KOBJSDIR)
1159 GLOB_MKDIRS += %(objdir) $(BD_MODDIR) $(KOBJSDIR)
1161 %(mmake)-clean : FILES := $(BD_OBJS) $(BD_MODULE) $(BD_KOBJ) $(BD_DEPS)
1163 @$(ECHO) "Cleaning up for module %(modname)"
1164 @$(RM) $(BD_OBJS) $(BD_KOBJ)
1168 #------------------------------------------------------------------------------
1170 # Explanation of this macro is done in the developer's manual
1171 %define build_module mmake=/A modname=/A modtype=/A modsuffix= \
1172 conffile= files="$(basename $(wildcard *.c))" \
1173 linklibfiles= cflags=$(CFLAGS) dflags=$(BD_DEFDFLAGS) \
1174 objdir=$(OBJDIR) moduledir=$(BD_DEFMODDIR) prefix=$(AROSDIR) \
1175 reffile=$(BD_DEFREFFILE) noref= \
1176 linklibname=$(BD_DEFLINKLIBNAME) uselibs= usehostlibs= \
1177 compiler=target genincludes=
1179 # Define metamake targets and their dependencies
1180 #MM- includes-all : %(mmake)-includes
1181 #MM %(mmake) : %(mmake)-includes core-linklibs
1182 #MM %(mmake)-kobj : %(mmake)-includes core-linklibs
1183 #MM %(mmake)-linklib : %(mmake)-includes
1184 #MM %(mmake)-quick : %(mmake)-includes-quick
1185 #MM %(mmake)-includes : %(mmake)-makefile %(mmake)-includes-dirs \
1186 #MM includes-generate-deps
1187 #MM %(mmake)-includes-quick
1188 #MM %(mmake)-includes-dirs
1189 #MM %(mmake)-makefile
1190 #MM %(mmake)-funclist
1193 # All MetaMake targets defined by this macro
1194 BD_ALLTARGETS := %(mmake) %(mmake)-quick %(mmake)-includes \
1195 %(mmake)-includes-quick %(mmake)-includes-dirs %(mmake)-clean \
1196 %(mmake)-kobj %(mmake)-funclist %(mmake)-linklib
1198 .PHONY : $(BD_ALLTARGETS) %(mmake)-makefile
1201 $(error using %build_module: modname may not be empty)
1204 $(error using %build_module: $(MODTYPE) has to be defined with the type of the module)
1207 # Default values for variables and arguments
1208 BD_DEFLINKLIBNAME := %(modname)
1209 BD_DEFREFFILE := %(objdir)/%(modname)_ALL.ref
1210 BD_DEFDFLAGS := %(cflags)
1211 OBJDIR ?= $(GENDIR)/$(CURDIR)
1213 ## Create genmodule include Makefile for the module
1215 %(mmake)-makefile : %(objdir)/Makefile.%(modname)
1217 %rule_genmodule_makefile \
1218 modname=%(modname) modtype=%(modtype) \
1219 modsuffix=%(modsuffix) targetdir=%(objdir) \
1220 conffile=%(conffile)
1222 %(objdir)/Makefile.%(modname) : | %(objdir)
1224 GLOB_MKDIRS += %(objdir)
1226 # Do not parse these statements if metatarget is not appropriate
1227 ifneq ($(filter $(TARGET),$(BD_ALLTARGETS)),)
1229 include %(objdir)/Makefile.%(modname)
1231 BD_DEFMODDIR := $(%(modname)_MODDIR)
1234 ## include files generation
1236 BD_INCDIR := %(prefix)/$(AROS_DIR_INCLUDE)
1237 ifeq (%(genincludes),yes)
1238 %(modname)_INCLUDES := proto/%(modname).h clib/%(modname)_protos.h defines/%(modname).h
1240 ifeq (%(genincludes),no)
1241 %(modname)_INCLUDES :=
1243 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1244 BD_DEFLIBDEFSINC := %(objdir)/%(modname)_deflibdefs.h
1246 %(mmake)-includes-quick : %(mmake)-includes
1247 %(mmake)-includes : $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1248 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1249 $(BD_LIBDEFSINC) $(BD_DEFLIBDEFSINC)
1251 ifneq ($(%(modname)_INCLUDES),)
1252 %rule_genmodule_includes modname=%(modname) modtype=%(modtype) \
1253 modsuffix=%(modsuffix) targetdir=%(objdir)/include \
1254 conffile=%(conffile) reffile=%(reffile)
1256 %rule_copy_diff_multi \
1257 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(GENINCDIR) \
1258 stampfile=%(objdir)/%(modname)_geninc
1260 %rule_copy_diff_multi \
1261 files=$(%(modname)_INCLUDES) srcdir=%(objdir)/include targetdir=$(BD_INCDIR) \
1262 stampfile=%(objdir)/%(modname)_incs
1264 %rule_genmodule_dummy modname=%(modname) modtype=%(modtype) \
1265 modsuffix=%(modsuffix) \
1266 targetdir=%(objdir)/dummyinc conffile=%(conffile)
1268 BD_INCDIRS := $(filter-out ./,$(sort $(dir $(%(modname)_INCLUDES))))
1270 TMP%(modname)_INCDIRS := \
1271 %(objdir)/include $(addprefix %(objdir)/include/,$(BD_INCDIRS)) \
1272 $(GENINCDIR) $(addprefix $(GENINCDIR)/,$(BD_INCDIRS)) \
1273 $(BD_INCDIR) $(addprefix $(BD_INCDIR)/,$(BD_INCDIRS))
1274 %rule_makedirs dirs=$(TMP%(modname)_INCDIRS) setuptarget=%(mmake)-includes-dirs
1276 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES)) : | %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1277 GLOB_MKDIRS += %(objdir)/dummyinc $(addprefix %(objdir)/dummyinc/,$(BD_INCDIRS))
1281 %rule_genmodule_genlibdefs modname=%(modname) modtype=%(modtype) \
1282 modsuffix=%(modsuffix) targetdir=%(objdir) \
1283 conffile=%(conffile)
1285 BD_LIBDEFSINC := %(objdir)/%(modname)_libdefs.h
1287 %(objdir)/%(modname)_deflibdefs.h : FILENAME := $(BD_LIBDEFSINC)
1288 %(objdir)/%(modname)_deflibdefs.h :
1289 @$(ECHO) "generating $@"
1290 @$(ECHO) "#define LC_LIBDEFS_FILE \"$(FILENAME)\"" >$@
1293 ## Generation of the funclist file
1295 %(mmake)-funclist : %(modname).funclist
1297 %rule_genmodule_funclist \
1298 modname=%(modname) modtype=%(modtype) modsuffix=%(modsuffix) \
1299 conffile=%(conffile) reffile=%(reffile)
1302 ## Extra genmodule src files generation
1304 %rule_genmodule_files modname=%(modname) modtype=%(modtype) \
1305 modsuffix=%(modsuffix) targetdir=%(objdir) \
1306 conffile=%(conffile) reffile=%(reffile)
1310 BD_FILES := %(files)
1311 BD_STARTFILES := $(addprefix %(objdir)/,$(%(modname)_STARTFILES))
1312 BD_ENDFILES := $(addprefix %(objdir)/,$(%(modname)_ENDFILES))
1314 BD_ARCHOBJS := $(wildcard %(objdir)/arch/*.o)
1315 BD_ARCHFILES := $(basename $(notdir $(BD_ARCHOBJS)))
1316 BD_NARCHFILES := $(filter-out $(BD_ARCHFILES),$(BD_FILES))
1318 BD_CFLAGS := %(cflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1319 BD_DFLAGS := %(dflags) -I%(objdir) -idirafter $(TOP)/$(CURDIR) -include %(objdir)/%(modname)_deflibdefs.h
1321 BD_LINKLIBCFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBFILES))
1322 BD_LINKLIBAFILES := $(addprefix %(objdir)/,$(%(modname)_LINKLIBAFILES))
1323 ifeq ($(strip $(%(modname)_LINKLIBFILES) %(linklibfiles)),)
1326 BD_LINKLIB := %(prefix)/$(AROS_DIR_LIB)/lib%(linklibname).a
1328 BD_LINKLIBFILES := $(BD_LINKLIBCFILES) $(BD_LINKLIBAFILES)
1330 BD_CCFILES := $(BD_NARCHFILES) $(BD_STARTFILES) \
1331 $(BD_ENDFILES) $(BD_LINKLIBCFILES) %(linklibfiles)
1333 %rule_compile_multi \
1334 basenames=$(BD_CCFILES) targetdir=%(objdir) \
1335 cflags=$(BD_CFLAGS) dflags=$(BD_DFLAGS) \
1336 compiler=%(compiler)
1338 ifneq ($(BD_LINKLIBAFILES),)
1339 %rule_assemble_multi \
1340 basenames=$(BD_LINKLIBAFILES) targetdir=%(objdir) suffix=.S
1343 ## function reference files generation
1346 basenames=$(BD_FILES) targetdir=%(objdir) \
1347 cflags="-I$(dir $(GENMODULE))/genmod_inc -I%(objdir)/dummyinc $(strip $(BD_CFLAGS))" \
1348 compiler=%(compiler)
1351 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(BD_FILES))))
1353 BD_REFS := $(addprefix %(objdir)/,$(addsuffix .ref, $(notdir $(filter-out %(noref),$(BD_FILES)))))
1356 %rule_join from=$(BD_REFS) to=%(reffile) \
1357 text="Collecting function references for module %(modname)"
1362 ifeq (%(modsuffix),)
1363 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modtype)
1364 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modtype).o
1366 BD_MODULE := %(prefix)/%(moduledir)/%(modname).%(modsuffix)
1367 BD_KOBJ := $(KOBJSDIR)/%(modname)_%(modsuffix).o
1370 %(mmake)-quick : %(mmake)
1371 %(mmake) : $(BD_MODULE) $(BD_LINKLIB)
1372 %(mmake)-kobj : $(BD_KOBJ) $(BD_LINKLIB)
1373 %(mmake)-linklib : $(BD_LINKLIB)
1375 BD_OBJS := $(addsuffix .o,$(BD_STARTFILES)) $(BD_ARCHOBJS) \
1376 $(addsuffix .o, $(addprefix %(objdir)/,$(notdir $(BD_NARCHFILES))))
1377 BD_ENDOBJS := $(addsuffix .o,$(BD_ENDFILES))
1378 BD_LINKLIBOBJS:= $(addsuffix .o,$(addprefix %(objdir)/,$(notdir %(linklibfiles))) $(BD_LINKLIBFILES))
1380 # The module is linked from all the compiled .o files
1381 %rule_linkmodule module=$(BD_MODULE) objs=$(BD_OBJS) \
1382 endobj=$(BD_ENDOBJS) err=%(modname).err objdir=%(objdir) \
1383 uselibs="%(uselibs)" usehostlibs="%(usehostlibs)"
1386 ifneq ($(BD_LINKLIB),)
1387 %rule_link_linklib libname=%(linklibname) objs=$(BD_LINKLIBOBJS) libdir=%(prefix)/$(AROS_DIR_LIB)
1389 $(BD_LINKLIB) : | %(prefix)/$(AROS_DIR_LIB)
1390 GLOB_MKDIRS += %(prefix)/$(AROS_DIR_LIB)
1393 # Link kernel object file
1394 BD_KAUTOLIB := workbench dos cybergraphics intuition layers graphics oop utility \
1396 BD_KBASE := WorkbenchBase DOSBase CyberGfxBase IntuitionBase LayersBase \
1397 GfxBase OOPBase UtilityBase ExpansionBase KeymapBase
1398 BD_KLIB := hiddgraphicsstubs hiddstubs amiga arossupport rom arosm autoinit libinit
1399 BD_KOBJ_LIBS := $(filter-out $(BD_KLIB),%(uselibs)) $(BD_KAUTOLIB)
1400 $(BD_KOBJ) : LINKLIBS:=$(BD_KOBJ_LIBS)
1401 $(BD_KOBJ) : FILTBASES:=$(addprefix -L ,$(BD_KBASE))
1402 $(BD_KOBJ) : $(BD_OBJS) $(BD_ENDOBJS)
1403 @$(ECHO) "Linking $@"
1404 @$(AROS_LD) -Ur -o $@ $^ -L$(AROS_LIB) $(addprefix -l,$(LINKLIBS))
1405 @$(OBJCOPY) $@ $(FILTBASES) `$(NM_PLAIN) $@ | $(AWK) '($$3 ~ /^__.*_(LIST|END)__$$/) || ($$3 ~ /^libraryset_.*$$/) {print "-L " $$3;}'`
1407 ## Dependency fine-tuning
1409 BD_DEPS := $(addsuffix .d,$(addprefix %(objdir)/,$(notdir $(BD_CCFILES))))
1410 %include_deps depstargets="%(mmake) %(mmake)-quick %(mmake)-kobj" deps=$(BD_DEPS)
1412 $(BD_OBJS) $(BD_DEPS) $(BD_REFS) : | %(objdir)
1413 $(BD_MODULE) : | %(prefix)/%(moduledir)
1414 $(BD_KOBJ) : | $(KOBJSDIR)
1415 GLOB_MKDIRS += %(objdir) %(prefix)/%(moduledir) $(KOBJSDIR)
1417 # Some include files need to be generated before the .c can be parsed.
1418 ifneq ($(filter $(TARGET),%(mmake) %(mmake)-includes %(mmake)-quick %(mmake)-kobj),) # Only for this target these deps are wanted
1419 BD_REFFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1420 $(addprefix %(objdir)/dummyinc/,$(%(modname)_INCLUDES))
1421 $(BD_REFS) : $(BD_REFFILE_DEPS) $(dir $(GENMODULE))/genmod_inc/aros/libcall.h
1423 BD_DFILE_DEPS := $(BD_LIBDEFSINC) %(objdir)/%(modname)_deflibdefs.h \
1424 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES))
1425 $(BD_DEPS) : $(BD_DFILE_DEPS)
1428 BD_TOCLEAN := $(BD_OBJS) $(BD_DEPS) %(reffile) \
1429 $(BD_REFS) $(BD_MODULE) $(BD_LINKLIB) $(BD_KOBJ) \
1430 $(addprefix $(GENINCDIR)/,$(%(modname)_INCLUDES)) \
1431 $(addprefix $(BD_INCDIR)/,$(%(modname)_INCLUDES)) \
1432 $(addprefix .c,$(BD_LINKLIBFILES)) $(BD_LINKLIBOBJS) $(BD_LIBDEFSINC) \
1433 %(objdir)/%(modname)_deflibdefs.h \
1434 $(addsuffix .c,$(BD_STARTFILES) $(BD_ENDFILES)) \
1436 %(mmake)-clean : FILES := $(BD_TOCLEAN)
1438 @$(ECHO) "Cleaning up for module %(modname)"
1441 endif # $(TARGET) in $(BD_ALLTARGETS)
1443 #------------------------------------------------------------------------------
1446 #------------------------------------------------------------------------------
1448 # - mmake is the mmaketarget
1449 # - libname is the baselibname e.g. lib%(libname).a will be created
1450 # - files are the C source files to include in the lib. The list of files
1451 # has to be given without the .c suffix
1452 # - asmfiles are the asm files to include in the lib. The list of files has to
1453 # be given with the .s suffix
1454 # - cflags are the flags to compile the source (default $(CFLAGS))
1455 # - dflags are the flags use during makedepend (default equal to cflags)
1456 # - aflags are the flags use during assembling (default $(AFLAGS))
1457 # - objdir is where the .o are generated
1458 # - libdir is the directory where the linklib will be placed (default $(LIBDIR))
1459 %define build_linklib mmake=/A libname=/A files="$(basename $(wildcard *.c))" \
1460 asmfiles= cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) objdir=$(OBJDIR) libdir=$(LIBDIR)
1462 # assign and generate the local variables used in this macro
1463 OBJDIR ?= $(GENDIR)/$(CURDIR)
1465 BD_FILES := %(files)
1466 BD_ASMFILES := %(asmfiles)
1468 BD_ARCHOBJS := $(wildcard %(objdir)/arch/*.o)
1469 BD_ARCHFILES := $(basename $(notdir $(BD_ARCHOBJS)))
1470 BD_NARCHFILES := $(filter-out $(BD_ARCHFILES),$(BD_FILES))
1472 BD_OBJS := $(BD_ARCHOBJS) $(addsuffix .o,$(addprefix %(objdir)/,$(notdir $(BD_NARCHFILES) $(BD_ASMFILES))))
1473 BD_DEPS := $(patsubst %.o,%.d,$(BD_OBJS))
1475 BD_CFLAGS := %(cflags)
1477 BD_DFLAGS := $(BD_CFLAGS)
1479 BD_DFLAGS := %(dflags)
1481 BD_AFLAGS := %(aflags)
1483 BD_LINKLIB := %(libdir)/lib%(libname).a
1485 .PHONY : %(mmake) %(mmake)-clean
1487 #MM %(mmake) : includes-generate-deps
1488 %(mmake) : $(BD_LINKLIB)
1492 @$(RM) $(BD_OBJS) $(BD_DEPS)
1494 ifeq ($(TARGET),%(mmake))
1495 ifneq ($(dir $(BD_FILES)),./)
1496 vpath %.c $(filter-out ./,$(dir $(BD_FILES)))
1499 %rule_compile basename=% targetdir=%(objdir) \
1500 cflags=$(BD_CFLAGS) dflags=$(BD_DFLAGS)
1501 %rule_assemble basename=% targetdir=%(objdir) \
1505 %rule_link_linklib libname=%(libname) objs=$(BD_OBJS) libdir=%(libdir)
1507 %include_deps depstargets=%(mmake) deps=$(BD_DEPS)
1509 $(BD_OBJS) $(BD_DEPS) : | %(objdir)
1510 $(BD_LINKLIB) : | %(libdir)
1511 GLOB_MKDIRS += %(objdir) %(libdir)
1514 #------------------------------------------------------------------------------
1517 #------------------------------------------------------------------------------
1519 # - mmake is the mmaketarget
1520 # - catalogs is the list of catalogs, without the .ct suffix (default *.ct)
1521 # - description is the catalog description file (.cd) (default *.cd)
1522 # - subdir is the destination subdir of the catalogs
1523 # - name is the name of the destination catalog, without the .catalog suffix
1524 # - source is the path to the generated source code file
1525 # - dir is the base destination directory (default $(AROS_CATALOGS))
1526 # - sourcedescription is the path to the FlexCat's source description file, without the .sd suffix
1528 %define build_catalogs mmake=/A name=/A subdir=/A \
1529 catalogs="$(basename $(wildcard *.ct))" source="../strings.h" \
1530 description="$(basename $(wildcard *.cd))" dir=$(AROS_CATALOGS) \
1531 sourcedescription="$(TOOLDIR)/C_h_orig"
1533 %buildid targets="%(mmake) %(mmake)-clean"
1535 BD_SRCS$(BDID) := $(addsuffix .ct, %(catalogs))
1536 BD_OBJS$(BDID) := $(addsuffix /%(subdir)/%(name).catalog, $(addprefix %(dir)/, %(catalogs)))
1537 BD_DIRS$(BDID) := $(addsuffix /%(subdir), $(addprefix %(dir)/, %(catalogs)))
1540 %(mmake) : $(BD_OBJS$(BDID)) %(source)
1542 $(BD_OBJS$(BDID)) : | $(BD_DIRS$(BDID))
1543 GLOB_MKDIRS += $(BD_DIRS$(BDID))
1545 %(dir)/%/%(subdir)/%(name).catalog : %.ct %(description).cd
1546 @$(ECHO) "Creating %(name) catalog for language $*."
1547 @$(FLEXCAT) %(description).cd $*.ct CATALOG=%(dir)/$*/%(subdir)/%(name).catalog || [ $$? -lt 10 ]
1550 %(source) : %(description).cd
1551 @$(ECHO) "Creating %(name) catalog source file %(source)"
1552 @$(FLEXCAT) %(description).cd %(source)=%(sourcedescription).sd
1557 $(RM) $(BD_OBJS$(BDID)) %(source)
1559 .PHONY: %(mmake) %(mmake-clean)
1563 #-----------------------------------------------------------------------------
1565 #-----------------------------------------------------------------------------
1567 # - mmake is the mmaketarget
1568 # - icons is a list of icon base names (ie. without the .info suffix)
1569 # - dir is the destination directory
1570 #-----------------------------------------------------------------------------
1572 %define build_icons mmake=/A icons=/A dir=/A
1574 %buildid targets="%(mmake) %(mmake)-clean"
1576 BD_OBJS$(BDID) := $(addprefix %(dir)/, $(addsuffix .info,%(icons)))
1579 %(mmake) : $(BD_OBJS$(BDID))
1581 %(dir)/%.info : %.info.src %.png
1582 @$(ECHO) Creating $(notdir $@)...
1583 @$(ILBMTOICON) $+ $@
1585 $(BD_OBJS$(BDID)) : | %(dir)
1586 GLOB_MKDIRS += %(dir)
1590 @$(RM) $(BD_OBJS$(BDID))
1596 #-----------------------------------------------------------------------------
1598 #------------------------------------------------------------------------------
1599 # Compile files for an arch-specific replacement of code for a module
1600 # - files: the basenames of the C files to compile.
1601 # - asmfiles: the basenames of the asm files to assemble.
1602 # - mainmmake: the mmake of the module in the main directory to compile these
1603 # arch specific files for.
1604 # - maindir: the object directory for the main module
1605 # - arch: the arch for which to compile these files. It can have the form
1606 # of ARCH, CPU or ARCH-CPU, e.g. linux, i386 or linux-i386
1607 # - cflags (default $(CFLAGS)): the C flags to use for compilation
1608 # - dflags: the flags used during creation of dependency file. If not specified
1609 # the same value as cflags will be used
1610 # - aflags: the flags used during assembling
1611 # - compiler: (host or target) specifies which compiler to use. By default
1612 # the target compiler is used
1613 %define build_archspecific files= asmfiles= mainmmake=/A maindir=/A arch=/A \
1614 cflags=$(CFLAGS) dflags= aflags=$(AFLAGS) compiler=target modulename=
1616 ifeq (%(files) %(asmfiles),)
1617 $(error no files or asmfiles given)
1620 %buildid targets="%(mainmmake)-%(arch)"
1622 #MM- %(mainmmake) : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1623 #MM- %(mainmmake)-linklib : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1624 #MM- %(mainmmake)-kobj : %(mainmmake)-$(ARCH)-$(CPU) %(mainmmake)-$(ARCH) %(mainmmake)-$(CPU)
1626 #MM %(mainmmake)-%(arch) : %(mainmmake)-includes
1629 $(error argument arch has to be non empty for the rule_compile_archspecific macro)
1632 BD_OBJDIR$(BDID) := $(GENDIR)/%(maindir)/arch
1633 BD_COBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1634 BD_ASMOBJS$(BDID) := $(addsuffix .o,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(asmfiles))))
1635 BD_OBJS$(BDID) := $(BD_COBJS$(BDID)) $(BD_ASMOBJS$(BDID))
1636 BD_DEPS$(BDID) := $(addsuffix .d,$(addprefix $(BD_OBJDIR$(BDID))/,$(notdir %(files))))
1638 ifeq ($(TARGET),%(mainmmake)-%(arch))
1639 vpath %.c $(filter-out ./,$(dir %(files)))
1640 vpath %.s $(filter-out ./,$(dir %(asmfiles)))
1641 vpath %.S $(filter-out ./,$(dir %(asmfiles)))
1644 $(BD_OBJS$(BDID)) : | $(BD_OBJDIR$(BDID))
1645 GLOB_MKDIRS += $(BD_OBJDIR$(BDID))
1648 %(mainmmake)-%(arch) :: $(BD_OBJS$(BDID))
1650 ifeq ($(findstring %(compiler),host target),)
1651 $(error unknown compiler %(compiler))
1653 ifeq (%(compiler),target)
1654 $(BD_COBJS$(BDID)) : TMP_CMD:=$(TARGET_CC)
1656 ifeq (%(compiler),host)
1657 $(BD_COBJS$(BDID)) : TMP_CMD:=$(HOST_CC)
1659 ifneq (%(modulename),)
1660 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags) -I$(GENDIR)/%(maindir) \
1661 --include $(GENDIR)/%(maindir)/%(modulename)_deflibdefs.h
1663 $(BD_COBJS$(BDID)) : TMP_CFLAGS:=%(cflags)
1665 ifeq ($(TARGET),%(mainmmake)-%(arch))
1666 $(BD_OBJDIR$(BDID))/%.o : %.c
1667 %compile_q opt=$(TMP_CFLAGS) cmd=$(TMP_CMD)
1671 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(cflags)
1673 $(BD_DEPS$(BDID)) : TMP_DFLAGS:=%(dflags)
1675 ifeq ($(TARGET),%(mainmmake)-%(arch))
1676 $(BD_OBJDIR$(BDID))/%.d : %.c
1677 %mkdepend_q flags=$(TMP_DFLAGS)
1680 $(BD_ASMOBJS$(BDID)) : AFLAGS:=%(aflags)
1682 ifeq ($(TARGET),%(mainmmake)-%(arch))
1683 $(BD_OBJDIR$(BDID))/%.o : %.s
1684 %assemble_q opt=$(AFLAGS)
1685 $(BD_OBJDIR$(BDID))/%.o : %.S
1686 %assemble_q opt=$(AFLAGS)
1689 %include_deps depstargets=%(mainmmake)-%(arch) deps=$(BD_DEPS$(BDID))
1691 #------------------------------------------------------------------------------
1699 # ======================
1700 # Old stuff, will probably be removed in the future
1705 # GNU Make automatic variables
1707 # $< First dependency
1708 # $? All newer dependencies
1709 # $^ All dependencies
1710 # $* The stem (ie. target is dir/a.foo.b and the pattern is
1711 # a.%.b, then the stem is dir/foo)
1713 #------------------------------------------------------------------------------
1714 # rule to generate libdefs.h with archtool (options may go away!)
1715 %define libdefs_rule conffile=lib.conf genlibdefstool=$(ARCHTOOL) dest=libdefs.h
1716 %(dest) : %(conffile) %(genlibdefstool)
1717 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1718 @%(genlibdefstool) -c -o $@ %(conffile)
1722 #------------------------------------------------------------------------------
1723 # generate asm files from c files (for debugging purposes)
1726 @$(ECHO) "Generating $(CURDIR)/$(notdir $@)..."
1727 @$(TARGET_CC) -S $(CFLAGS) $< -c -o $@
1730 #------------------------------------------------------------------------------
1731 # Convert two png images to an Amiga icon file based on the description
1732 # file %(from), with outputfile going to %(to).
1733 %define makeicon2 from=$< to=$@ img1="$(basename $(basename $<))_N.png" img2="$(basename $(basename $<))_S.png"
1734 @$(ECHO) "Creating icon %(to)..."
1735 @$(PNGTOPNM) %(img1) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon1.iff
1736 @$(PNGTOPNM) %(img2) | $(PPMTOILBM) -maxplanes 8 >$(GENDIR)/genicon2.iff
1737 @$(ILBMTOICON) %(from) $(GENDIR)/genicon1.iff $(GENDIR)/genicon2.iff %(to)
1740 #------------------------------------------------------------------------------
1741 # NOTE: The following are all part of Iain's build changes, please don't use
1742 # or change anything below this line until you know what you are doing. This
1743 # is so that I don't conflict with the semantics of any of the above macros.
1744 #------------------------------------------------------------------------------
1746 #------------------------------------------------------------------------------
1747 # Copy files from one directory to another.
1749 %define copy_files_q files=$(FILES) src=. dst=/A maketarget=files-copy
1751 SRC_FILES := $(addprefix %(src)/, %(files))
1752 DST_FILES := $(addprefix %(dst)/, %(files))
1754 %(maketarget) : setup $(DST_FILES)
1756 $(DST_FILES) : %(dst)/% : %(src)/%
1764 #----------------------------------------------------------------------------------
1765 # Copy a diretory recursively to another place, preserving the original
1766 # hierarchical structure
1768 # src: the source directory whose content will be copied
1769 # dst: the directory where to copy src's content. If not existing, it will be made.
1771 %define copy_dir_recursive mmake=/A src=$(TOP)/$(CURDIR) dst=/A
1773 %(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)
1774 %(mmake)_DIRS := $(sort $(dir $(%(mmake)_FILES)))
1776 define %(mmake)_mkdir
1781 define %(mmake)_copy
1782 $(3)/$(1): $(2)/$(1) | $(dir $(3)/$(1))
1789 %(mmake): | $(GENDIR)/$(CURDIR)
1790 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1791 $(ECHO) "all: $(addprefix \$$(DST)/,$(%(mmake)_FILES))" > $$m
1792 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1793 for d in $(%(mmake)_DIRS); do \
1794 $(ECHO) "\$$(DST)/$$d: ; $(MKDIR) \$$@" >> $$m; \
1796 @m="$(GENDIR)/$(CURDIR)/%(mmake)-auxiliary.mak"; \
1797 for f in $(%(mmake)_FILES); do \
1798 $(ECHO) "\$$(DST)/$$f: \$$(SRC)/$$f | \$$(dir \$$(DST)/$$f); $(CP) \$$< \$$@" >> $$m; \
1800 for dst in %(dst); do \
1801 $(MAKE) -f $$m DST=$$dst SRC=%(src) all; \
1804 $(GENDIR)/$(CURDIR):
1809 #------------------------------------------------------------------------------
1810 # Copy include files into the includes directories. There are currently
1811 # two include directories. One for building AROS $(AROS_INCLUDES) and one
1812 # for building tools that need to run on the host system $(GENINCDIR). The
1813 # $(GENINCDIR) path must not contain any references to the C runtime
1814 # library header files.
1816 %define copy_includes mmake=includes-copy includes=$(INCLUDE_FILES) path=. \
1817 dir= compiler=target
1819 ifeq ($(findstring %(compiler),host target),)
1820 $(error %copy_includes: compiler argument (%(compiler)) has to be host or target)
1824 BD_INCL_FILES := $(subst %(dir),$(GENINCDIR)/%(path),%(includes))
1825 BD_INC_PATH := %(dir)/
1827 BD_INCL_FILES := $(addprefix $(GENINCDIR)/%(path)/,%(includes))
1831 $(BD_INCL_FILES) : $(GENINCDIR)/%(path)/% : $(BD_INC_PATH)%
1835 ifeq (%(compiler),target)
1838 BD_INCL_FILES2 := $(subst %(dir),$(AROS_INCLUDES)/%(path),%(includes))
1840 BD_INCL_FILES2 := $(addprefix $(AROS_INCLUDES)/%(path)/,%(includes))
1843 BD_INCL_FILES += $(BD_INCL_FILES2)
1845 $(BD_INCL_FILES2) : $(AROS_INCLUDES)/%(path)/% : $(BD_INC_PATH)%
1850 %(mmake) : $(BD_INCL_FILES)
1854 $(BD_INCL_FILES) : | $(dir $(BD_INCL_FILES))
1855 GLOB_MKDIRS += $(dir $(BD_INCL_FILES))
1859 %define make_hidd_stubs hidd=/A cflags=$(CFLAGS) dflags=$(CFLAGS) parenttarget=linklibs
1860 STUBS_SRC := $(addsuffix .c,$(STUBS))
1861 STUBS_MEM := $(addsuffix .o,$(STUBS))
1862 STUBS_OBJ := $(addprefix $(OBJDIR)/,$(STUBS_MEM))
1863 STUBS_DEP := $(addprefix $(OBJDIR)/,$(addsuffix .d,$(STUBS)))
1864 HIDD_LIB := $(AROS_LIB)/libhiddstubs.a
1866 #MM- linklibs : hidd-%(hidd)-stubs
1867 #MM- %(parenttarget): hidd-%(hidd)-stubs
1868 #MM hidd-%(hidd)-stubs : includes includes-copy
1869 hidd-%(hidd)-stubs : setup $(HIDD_LIB)($(STUBS_MEM))
1871 $(HIDD_LIB)($(STUBS_MEM)) : $(STUBS_OBJ)
1874 $(STUBS_OBJ) : $(STUBS_SRC)
1875 %compile_q cmd=$(TARGET_CC) opt=%(cflags)
1877 $(STUBS_DEP) : $(STUBS_SRC)
1878 %mkdepend_q flags=%(dflags)
1881 %mkdirs_q $(OBJDIR) $(LIBDIR)
1885 -@$(RM) $(HIDD_LIB) $(OBJDIR)
1887 DEPS := $(DEPS) $(STUBS_DEP)
1891 #------------------------------------------------------------------------------
1892 # Build an imported source tree which uses the configure script from the
1893 # autoconf package. This rule will try to "integrate" the produced files as
1894 # much as possible in the AROS build, for example by putting libraries in the
1895 # standard library directory, includes in the standard include directory, and
1896 # so on. You can however override this behaviour.
1898 # As a special "bonus" for you, the PROGDIR environment variable is defined to
1899 # be %(bindir) (or its deduced value) when running "make install", and
1900 # "PROGDIR:" when running "make" alone; you can use this feature to pass the
1901 # configure script some more parameters whose value depends upon the PROGDIR
1902 # env var, so that the program gets all its stuff installed in the proper place
1903 # when building it, but when running it from inside AROS it can also find that
1904 # stuff by simply opening PROGDIR:, which it will do automatically if it uses
1905 # the configuration parameters set when running ./configure
1907 # *NOTICE*: DO NOT put a trailing '/' (slash) after $PROGDIR, as the variable
1908 # already contains either a '/' (slash) or a ':' (colon), thus simply attach it
1909 # to the name which has to follow it.
1912 %define build_with_configure mmake=/A srcdir=$(TOP)/$(CURDIR) prefix= \
1913 aros_prefix= extraoptions= nix_dir_layout= nix=no compiler=target \
1914 install_target=install postconfigure= postinstall= \
1918 %(mmake)-prefix := %(prefix)
1920 %(mmake)-prefix := $(AROS_CONTRIB)
1923 ifneq (%(aros_prefix),)
1924 %(mmake)-aros_prefix := %(aros_prefix)
1926 %(mmake)-aros_prefix := $(%(mmake)-prefix)
1930 %(mmake)-nix := -nix
1931 %(mmake)-volpfx := /
1932 %(mmake)-volsfx := /
1934 ifeq (%(nix_dir_layout),)
1935 %(mmake)-nix_dir_layout := yes
1938 %(mmake)-volsfx := :
1940 ifeq (%(nix_dir_layout),)
1941 %(mmake)-nix_dir_layout := no
1945 %(mmake)-volfunc = $(%(mmake)-volpfx)$(notdir $1)$(%(mmake)-volsfx)
1947 %(mmake)-install_opts := prefix=$(%(mmake)-prefix) \
1948 exec_prefix=$(%(mmake)-prefix) %(install_env)
1950 # Check if chosen compiler is valid
1951 ifeq ($(findstring %(compiler),host target kernel),)
1952 $(error unknown compiler %(compiler))
1955 # Set legacy 'host' variable based on chosen compiler
1956 ifeq (%(compiler),host)
1962 ifeq ($(filter yes, $(%(mmake)-nix_dir_layout) %(host)),yes)
1963 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)/bin
1964 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1967 %(mmake)-config_opts := --prefix=/PROGDIR --bindir=/PROGDIR --sbindir=/PROGDIR \
1968 --libdir=/LIB --includedir=/INCLUDE --oldincludedir=/INCLUDE
1970 %(mmake)-config_opts := --prefix=$(%(mmake)-aros_prefix)
1973 %(mmake)-PROGDIR := $(%(mmake)-aros_prefix)
1975 %(mmake)-install_opts := bindir=$(%(mmake)-prefix) \
1976 sbindir=$(%(mmake)-prefix) \
1977 libdir=$(AROS_LIB) includedir=$(AROS_INCLUDES) \
1978 oldincludedir=$(AROS_INCLUDES) %(install_env)
1982 .PHONY : %(mmake) %(mmake)-clean %(mmake)-build_and_install-quick
1984 #MM- %(mmake) : setup includes linklibs-core %(mmake)-quick
1986 ifneq (%(install_target),)
1987 %(mmake)-install_command = \
1988 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1989 -C $(GENDIR)/$(CURDIR) %(install_target) && \
1990 $(TOUCH) $(GENDIR)/$(CURDIR)/.installed
1992 %(mmake)-uninstall_command = \
1993 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
1994 $(MAKE) PROGDIR="$(%(mmake)-PROGDIR)/" $(%(mmake)-install_opts) \
1995 -C $(GENDIR)/$(CURDIR) uninstall
1997 %(mmake)-install_command := true
1998 %(mmake)-uninstall_command := true
2001 #MM- %(mmake)-quick : %(mmake)-configure %(postconfigure) %(mmake)-build_and_install-quick %(postinstall)
2004 %(mmake)-build_and_install-quick : $(GENDIR)/$(CURDIR)/.configured
2005 if ! $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -q -C $(GENDIR)/$(CURDIR); then \
2006 $(RM) $(GENDIR)/$(CURDIR)/.installed && \
2007 $(MAKE) PROGDIR="$(call %(mmake)-volfunc, PROGDIR)" -C $(GENDIR)/$(CURDIR) && \
2008 $(%(mmake)-install_command); \
2011 %(srcdir)/.files-touched:
2012 find %(srcdir) -exec $(TOUCH) -r %(srcdir)/configure '{}' \; && \
2016 %(mmake)-uninstall :
2017 $(%(mmake)-uninstall_command)
2019 ifneq ($(DEBUG),yes)
2020 %(mmake)-s_flag = -s
2024 %(mmake)-configure : $(GENDIR)/$(CURDIR)/.configured
2026 ifeq (%(compiler),host)
2027 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2029 %mkdirs_q $(GENDIR)/$(CURDIR)
2030 cd $(GENDIR)/$(CURDIR) && \
2031 find . -name config.cache -exec $(RM) '{}' \; && \
2033 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) && \
2036 ifeq (%(compiler),target)
2037 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2039 %mkdirs_q $(GENDIR)/$(CURDIR)
2040 cd $(GENDIR)/$(CURDIR) && \
2041 find . -name config.cache -exec $(RM) '{}' \; && \
2042 CC="$(TARGET_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2043 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2044 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2045 --host=$(AROS_TARGET_CPU)-aros \
2046 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2047 --without-x --without-pic --disable-shared && \
2050 ifeq (%(compiler),kernel)
2051 $(GENDIR)/$(CURDIR)/.configured : %(srcdir)/.files-touched $(TOP)/$(CURDIR)/mmakefile
2053 %mkdirs_q $(GENDIR)/$(CURDIR)
2054 cd $(GENDIR)/$(CURDIR) && \
2055 find . -name config.cache -exec $(RM) '{}' \; && \
2056 CC="$(KERNEL_CC) $(%(mmake)-nix) $(%(mmake)-s_flag)" \
2057 AS="$(TARGET_AS)" CC_FOR_BUILD="$(HOST_CC)" \
2058 %(srcdir)/configure $(%(mmake)-config_opts) %(extraoptions) \
2059 --host=$(AROS_TARGET_CPU)-aros \
2060 --target=$(AROS_TARGET_CPU)-aros --build=local --disable-nls \
2061 --without-x --without-pic --disable-shared && \
2066 %(mmake)-clean : %(mmake)-uninstall
2067 @$(RM) $(GENDIR)/$(CURDIR)
2070 #############################################################################
2071 #############################################################################
2073 ## Miscellaneous macros. Everything that doesn't fit above should be put ##
2076 #############################################################################
2077 #############################################################################
2079 #----------------------------------------------------------------------------------
2080 # Given an archive name, patches names and locations where to find them, fetch
2081 # the archive and the patches from any of those locations, unpack the archive
2082 # and then apply the patches.
2084 # Locations currently supported are http and ftp sites, plus local filesystem
2085 # directories. Supported archives are .tar.bz2 and .tar.gz. To modify this,
2086 # the fetch.sh script needs to be modified, since this macro relies on that script.
2090 # - archive_origins = list of locations where to find the archive. They are tried
2091 # in sequence, until the archive is found and fetching it
2092 # succeeded. If not specified, the current directory is assumed.
2093 # - archive = the archive name. Mandatory.
2094 # - destination = the local directory where to put the archive and patches.
2095 # If not specified, the current directory is assumed.
2096 # - patches_origins = list of locations where to find the patches. They are tried
2097 # in sequence, until a patch is found and fetching it
2098 # succeeded. If not specified, the current directory is assumed.
2099 # - patches_specs = list of "patch specs". A patch spec is of the form
2100 # patch_name[:[patch_subdir][:patch_opt]].
2102 # - patch_name = the name of the patch file
2103 # - patch_subdir = the directory within \destination\ where to
2105 # - patch_opt = any options to pass to the `patch' command
2106 # when applying the patch.
2108 # The patch_subdir and patch_opt fields are optional.
2110 %define fetch archive_origins=. archive=/A suffixes= destination=. patches_origins=. patches_specs=::
2111 $(FETCH) -ao "%(archive_origins)" -a %(archive) -as "%(suffixes)" -d %(destination) \
2112 -po "%(patches_origins)" -p %(patches_specs)
2115 #-----------------------------------------------------------------------------------------
2116 # Joins the features of %fetch and %build_with_configure, taking advantage of
2117 # the naming scheme of GNU packages. GNU packages names are in the form
2119 # <package name>-<version number>.<archive format suffix>
2121 # If a patch is provided, it *must* be named the following way:
2123 # <package name>-<version number>-aros.diff
2125 # Moreover, it *must* be appliable with the -p1 option of the `patch' command after
2126 # CD'ing into the archive's extracted directory.
2128 # Note that whilst the %fetch macro accepts a list of patches for any given archive,
2129 # the %fetch_and_build macro only accept *one* patch for each package. It's up to you
2130 # to make that patch fully comprehensive.
2132 # NOTE: GNU packages are always compiled with *nix semantics turned on.
2136 # - mmake = the meta make target, as would be supplied to the %build_with_configure
2138 # - package = the GNU package name, sans version and archive format suffixes.
2139 # - version = the package's version number, or otherwise any other version string.
2140 # It gets appended to the package name to form the basename of the archive.
2141 # - suffixes = a list of suffixes to apped to the the package name plus the
2142 # version. Each one of them is tried until a matching archive is found.
2143 # Defaults to "tat.bz2 tar.gz".
2144 # - destination = same meaning as the one for the %fetch macro
2145 # - package_repo = same meaning as the one of the %fetch macro's %(archive_origins) argument
2146 # - patch = "yes" or "no", depending on whether a patch for this package needs to be
2148 # - patch_repo = same meaning as the one of the %fetch macro's %(patches_origins) argument
2149 # - prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2151 # - aros_prefix = same meaning as the one for the %build_with_configure macro. Defaults to
2153 # - extraoptions = same meaning as the one for the %build_with_configure macro.
2154 # - postinstall = same meaning as the one for the %build_with_configure macro.
2156 %define fetch_and_build mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2157 srcdir= package_repo= patch=no patch_repo= prefix= \
2158 aros_prefix= extraoptions= postconfigure= postinstall= nix=no nix_dir_layout=
2160 #MM- %(mmake)-quick : %(mmake)-%(subpackage)-quick
2161 #MM- %(mmake)-%(subpackage)-quick : %(mmake)-%(subpackage)-fetch
2163 %(mmake)-archbase := %(package)-%(version)
2166 %(mmake)-prefix := $(CONTRIB_DIR)/%(package)
2168 %(mmake)-prefix := %(prefix)
2171 ifneq (%(subpackage),)
2172 %(mmake)-%(subpackage)-archbase := %(package)-%(subpackage)-%(version)
2174 %(mmake)-%(subpackage)-archbase := %(package)-%(version)
2178 %(mmake)-%(subpackage)-srcdir := %(srcdir)
2180 %(mmake)-%(subpackage)-srcdir := $(%(mmake)-archbase)
2184 %(mmake)-%(subpackage)-patches_specs := $(%(mmake)-%(subpackage)-archbase)-aros.diff:$(%(mmake)-%(subpackage)-srcdir):-p1
2186 %(mmake)-%(subpackage)-patches_specs := ::
2189 #MM- %(mmake)-fetch : %(mmake)-%(subpackage)-fetch
2191 .PHONY : %(mmake)-%(subpackage)-fetch
2193 %(mmake)-%(subpackage)-fetch :
2194 %fetch archive=$(%(mmake)-%(subpackage)-archbase) suffixes="%(suffixes)" \
2195 destination=$(PORTSDIR)/%(package) \
2196 archive_origins=". %(package_repo)" \
2197 patches_specs="$(%(mmake)-%(subpackage)-patches_specs)" patches_origins=". %(patch_repo)"
2199 #MM- %(mmake) : %(mmake)-%(subpackage)
2201 PACKAGES_DIR := $(AROSDIR)/../Packages
2203 %(mmake)-%(subpackage)-package-dir := $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)
2205 %(mmake)-%(subpackage)-package-basename := \
2206 $(PACKAGES_DIR)/$(%(mmake)-%(subpackage)-archbase)-aros.$(AROS_TARGET_CPU)
2208 %build_with_configure mmake=%(mmake)-%(subpackage) \
2209 srcdir=$(PORTSDIR)/%(package)/$(%(mmake)-%(subpackage)-srcdir) \
2210 nix=%(nix) nix_dir_layout=%(nix_dir_layout) prefix="$(%(mmake)-%(subpackage)-package-dir)" \
2211 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall) \
2212 %(mmake)-%(subpackage)-make-package" extraoptions="%(extraoptions)"
2214 .PHONY : %(mmake)-%(subpackage)-make-package
2215 #MM %(mmake)-%(subpackage)-make-package : %(mmake)-%(subpackage)-quick
2218 %(mmake)-%(subpackage)-make-package : $(%(mmake)-%(subpackage)-package-basename).tar.bz2
2220 #There seems to be a bug, either with my clock or with make, 'cause it may happen
2221 #that $^ and $@ have exactly the same mtime, and in that case make tries
2222 #to rebuild $@ again, which would fail because the directory where
2223 #the package got installed would not exist anymore.
2224 #We work this around by using an if statement to manually check the mtimes.
2225 $(%(mmake)-%(subpackage)-package-basename).tar.bz2 :
2226 @if test $(GENDIR)/$(CURDIR)/.installed -nt $@ || ! test -f $@; then \
2228 $(ECHO) "Building \`$(%(mmake)-%(subpackage)-package-basename).tar.bz2'" && \
2229 cd $(%(mmake)-%(subpackage)-package-dir) && \
2230 tar -cvf $(%(mmake)-%(subpackage)-package-basename).tar * && \
2231 mkdir -p "$(%(mmake)-prefix)" && \
2232 cd .. && $(RM) -r $(%(mmake)-%(subpackage)-package-dir) && \
2233 tar -xf $(%(mmake)-%(subpackage)-package-basename).tar -C "%(prefix)"/ && \
2234 bzip2 -9 -f $(%(mmake)-%(subpackage)-package-basename).tar && \
2235 cd .. && $(RM) $(%(mmake)-%(subpackage)-archbase); \
2239 %define fetch_and_build_gnu mmake=/A package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2240 srcdir= package_repo= patch=no patch_repo= prefix=$(GNUDIR) \
2241 aros_prefix=/GNU extraoptions= postconfigure= postinstall=
2243 GNU_REPOSITORY := http://ftp.gnu.org/pub/gnu
2245 %fetch_and_build mmake="%(mmake)" package="%(package)" subpackage="%(subpackage)" version="%(version)" \
2246 suffixes="%(suffixes)" srcdir="%(srcdir)" \
2247 package_repo="%(package_repo) $(GNU_REPOSITORY)/%(package)" \
2248 patch="%(patch)" patch_repo="%(patch_repo)" \
2249 prefix="%(prefix)" aros_prefix="%(aros_prefix)" extraoptions="%(extraoptions)" \
2250 postconfigure="%(postconfigure)" postinstall="%(postinstall)" nix=yes
2254 #-----------------------------------------------------------------------------------------
2255 # Same job as the one of %fetch_and_build_gnu, except that this one assumes
2256 # that the package is a "Development" package, and as such it needs to be placed
2257 # under the $(AROS_DEVELOPMENT) directory, as a default.
2259 # All the arguments have the same meaning as the ones of the %fetch_and_build_gnu
2260 # macro, but notice that %fetch_and_build_gnu_development *doesn't* have a
2261 # "mmake" argument, because the metatarget is implicitely defined as
2263 # #MM- development-%(package)
2265 %define fetch_and_build_gnu_development package=/A subpackage= version=/A suffixes="tar.bz2 tar.gz" \
2266 srcdir= package_repo= patch=no patch_repo= prefix=$(AROS_DEVELOPMENT) \
2267 aros_prefix=/Development postconfigure= postinstall= extraoptions=
2269 #MM- development : development-%(package)
2272 %fetch_and_build_gnu mmake=development-%(package) package=%(package) subpackage="%(subpackage)" \
2273 version=%(version) suffixes="%(suffixes)" srcdir="%(srcdir)" \
2274 package_repo="%(package_repo)" patch="%(patch)" patch_repo="%(patch_repo)" prefix=%(prefix) \
2275 aros_prefix="%(aros_prefix)" postconfigure="%(postconfigure)" postinstall="%(postinstall)" \
2276 extraoptions="%(extraoptions)"