2 include $(TOP)/config/make.cfg
5 # This is a rather special makefile. It builds both a shared library
6 # and a link library from the same source, with only a small amount of
9 USER_CFLAGS := -I$(SRCDIR)/$(CURDIR) -I$(SRCDIR)/$(CURDIR)/include -I$(SRCDIR)/rom/exec -I$(GENDIR)/rom/exec \
10 -D__mb_cur_max=MB_CUR_MAX \
13 # We are trying to build:
14 # $(AROS_LIBS)/arosc.library from $(SHARED)
15 # $(AROS_LIB)/libarosc.a from $(COMMON) and $(STUBS)
17 # It turns out that some of $(SHARED) refer to things in $(COMMON), so
18 # I've put that into the arosc.library as well.
19 MODULE := arosc.library
20 SHARED_LIB := $(AROS_LIB)/libarosc.a
22 # New: Also trying to build
23 # $(AROS_LIB)/librom.a from $(COMMON) and $(ROMONLY)
25 # This is a library that is allowed to be used inside modules and the
26 # kernel. It must include no code which refers to global variables.
28 # Currently the main difference is that it includes a different __assert()
29 # function to handle asserts in the kernel.
30 ROM_LIB := $(AROS_LIB)/librom.a
33 LIB := $(SHARED_LIB) $(ROM_LIB) $(AROS_LIBS)/$(MODULE)
36 # - Common always exist in the link library.
97 # - Shared are in either the shared linklib, or the arosc.library module
224 locale/fix_grouping \
243 locale/setrunelocale \
306 sharecontextwithchild \
425 # Objects for rom.lib, from the static build.
454 # - The stubs are generated, and are in the shared link library.
455 STUBS := $(wildcard $(OBJDIR)/stubs/*.o)
458 DEPS := $(foreach f,$(COMMON),$(OBJDIR)/$(f).d) \
459 $(foreach f,$(SHARED),$(OBJDIR)/shared/$(f).d) \
460 $(OBJDIR)/shared/arosc_init.d $(OBJDIR)/shared/arosc_functable.d \
461 $(OBJDIR)/shared/arosc_endtag.d
463 COMMON_OBJ := $(foreach f,$(COMMON),$(OBJDIR)/$(f).o) \
464 $(foreach f,$(COMMON_ARCH),$(OBJDIR)/arch/$(f).o)
466 SHARED_OBJ := $(COMMON_OBJ) $(STUBS) $(OBJDIR)/arosc_autoinit.o
468 MODULE_OBJ := $(foreach f, $(SHARED), $(OBJDIR)/shared/$(f).o) \
469 $(foreach f,$(SHARED_ARCH),$(OBJDIR)/shared/arch/$(f).o)
471 ROM_OBJ := $(foreach f,$(ROM_ONLY),$(OBJDIR)/rom/$(f).o) \
472 $(foreach f,$(ROM_COMMON),$(OBJDIR)/$(f).o) \
473 $(foreach f,$(ROM_COMMON_ARCH),$(OBJDIR)/arch/$(f).o) \
474 $(foreach f,$(ROM_STATIC),$(OBJDIR)/static/$(f).o)
476 # These are added to the link step of arosc.library
477 LIBS := -lgcc -L$(AROS_LIB) -larosm -lautoinit
478 DEP_LIBS := arosm autoinit
480 #MM- linklibs-core : linklibs-clib
481 #MM- linklibs : linklibs-clib
482 #MM linklibs-clib : setup-clib includes linklibs-mlib linklibs-autoinit \
486 linklibs-clib-quick : linklibs-clib
488 linklibs-clib : setup-clib $(SHARED_LIB) $(ROM_LIB) $(AROS_LIBS)/$(MODULE)
490 $(OBJDIR)/libarosccommon.a: $(COMMON_OBJ)
493 $(SHARED_LIB) : $(SHARED_OBJ)
496 $(ROM_LIB) : $(ROM_OBJ)
499 $(AROS_LIBS)/$(MODULE) : $(MODULE_OBJ) $(OBJDIR)/libarosccommon.a
501 objs="$(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(MODULE_OBJ)" \
502 endtag="$(OBJDIR)/shared/arosc_endtag.o" \
503 ldflags="$(LDFLAGS) -L$(OBJDIR) $(NOSTDLIB_LDFLAGS)" \
504 libs="$(LIBS) -larosccommon"
506 $(OBJDIR)/static/%.o : %.c
507 %compile_q opt="$(CFLAGS) -DAROSC_STATIC"
509 $(OBJDIR)/shared/%.o : %.c
510 %compile_q opt="$(CFLAGS) -DAROSC_SHARED"
512 $(OBJDIR)/rom/%.o : %.c
513 %compile_q opt="$(CFLAGS)"
516 %compile_q opt="$(CFLAGS)"
518 # Need to copy these files in from the machine dependant build.
519 $(OBJDIR)/shared/%jmp.o : $(OBJDIR)/%jmp.o
522 # The rules to create the dependancy files.
523 $(OBJDIR)/static/%.d : %.c
524 %mkdepend_q flags=$(CFLAGS)
526 $(OBJDIR)/shared/%.d : %.c
527 %mkdepend_q flags="$(CFLAGS) -include __arosc_privdata.h"
529 $(OBJDIR)/rom/%.d : %.c
530 %mkdepend_q flags=$(CFLAGS)
533 %mkdepend_q flags=$(CFLAGS)
537 %mkdirs_q $(AROS_INCLUDES)/sys $(OBJDIR)
538 %mkdirs_q $(OBJDIR)/static $(OBJDIR)/shared $(OBJDIR)/rom
539 %mkdirs_q $(AROS_LIB) $(AROS_LIBS)
542 check : $(TESTDIR)/snprint
544 $(TESTDIR)/snprintf : snprintf.c $(LIBDIR)/startup.o $(DEPLIBS)
545 $(CC) -DTEST $(ILDFLAGS) $(LIBDIR)/startup.o $< -o $@ $(LIBS)
549 -$(RM) $(OBJDIR) *.err $(LIB)
554 # Fix up the deps, these won't end up in $^, but they'll make it work.
555 $(AROS_LIBS)/$(MODULE) : $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(OBJDIR)/shared/arosc_endtag.o
556 $(AROS_LIBS)/$(MODULE) : $(foreach f,$(DEP_LIBS),$(AROS_LIB)/lib$(f).a)
557 $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o: $(AROS_INCLUDES)/sys/syscall.def