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. -Iinclude -I$(TOP)/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
211 locale/fix_grouping \
228 locale/setrunelocale \
397 # Objects for rom.lib, from the static build.
426 # - The stubs are generated, and are in the shared link library.
427 STUBS := $(wildcard $(OBJDIR)/stubs/*.o)
430 DEPS := $(foreach f,$(COMMON),$(OBJDIR)/$(f).d) \
431 $(foreach f,$(SHARED),$(OBJDIR)/shared/$(f).d) \
432 $(OBJDIR)/shared/arosc_init.d $(OBJDIR)/shared/arosc_functable.d \
433 $(OBJDIR)/shared/arosc_endtag.d
435 COMMON_OBJ := $(foreach f,$(COMMON),$(OBJDIR)/$(f).o) \
436 $(foreach f,$(COMMON_ARCH),$(OBJDIR)/arch/$(f).o)
438 SHARED_OBJ := $(COMMON_OBJ) $(STUBS) $(OBJDIR)/arosc_autoinit.o
440 MODULE_OBJ := $(foreach f, $(SHARED), $(OBJDIR)/shared/$(f).o)
442 ROM_OBJ := $(foreach f,$(ROM_ONLY),$(OBJDIR)/rom/$(f).o) \
443 $(foreach f,$(ROM_COMMON),$(OBJDIR)/$(f).o) \
444 $(foreach f,$(ROM_COMMON_ARCH),$(OBJDIR)/arch/$(f).o) \
445 $(foreach f,$(ROM_STATIC),$(OBJDIR)/static/$(f).o)
447 # These are added to the link step of arosc.library
448 LIBS := -L$(AROS_LIB) -larosm -lautoinit
449 DEP_LIBS := arosm autoinit
451 #MM- linklibs-core : linklibs-clib
452 #MM- linklibs : linklibs-clib
453 #MM linklibs-clib : setup-clib includes linklibs-mlib linklibs-autoinit \
457 linklibs-clib-quick : linklibs-clib
459 linklibs-clib : setup-clib $(SHARED_LIB) $(ROM_LIB) $(AROS_LIBS)/$(MODULE)
461 $(OBJDIR)/libarosccommon.a: $(COMMON_OBJ)
464 $(SHARED_LIB) : $(SHARED_OBJ)
467 $(ROM_LIB) : $(ROM_OBJ)
470 $(AROS_LIBS)/$(MODULE) : $(MODULE_OBJ) $(OBJDIR)/libarosccommon.a
472 objs="$(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(MODULE_OBJ)" \
473 endtag="$(OBJDIR)/shared/arosc_endtag.o" \
474 ldflags="$(LDFLAGS) -L$(OBJDIR) $(NOSTDLIB_LDFLAGS)" \
475 libs="$(LIBS) -larosccommon"
477 $(OBJDIR)/static/%.o : %.c
478 %compile_q opt="$(CFLAGS)"
480 $(OBJDIR)/shared/%.o : %.c
481 %compile_q opt="$(CFLAGS) -DAROSC_SHARED"
483 $(OBJDIR)/rom/%.o : %.c
484 %compile_q opt="$(CFLAGS)"
487 %compile_q opt="$(CFLAGS)"
489 # Need to copy these files in from the machine dependant build.
490 $(OBJDIR)/shared/%jmp.o : $(OBJDIR)/%jmp.o
493 # The rules to create the dependancy files.
494 $(OBJDIR)/static/%.d : %.c
495 %mkdepend_q flags=$(CFLAGS)
497 $(OBJDIR)/shared/%.d : %.c
498 %mkdepend_q flags="$(CFLAGS) -include __arosc_privdata.h"
500 $(OBJDIR)/rom/%.d : %.c
501 %mkdepend_q flags=$(CFLAGS)
504 %mkdepend_q flags=$(CFLAGS)
508 %mkdirs_q $(AROS_INCLUDES)/sys $(OBJDIR)
509 %mkdirs_q $(OBJDIR)/static $(OBJDIR)/shared $(OBJDIR)/rom
510 %mkdirs_q $(AROS_LIB) $(AROS_LIBS)
513 check : $(TESTDIR)/snprint
515 $(TESTDIR)/snprintf : snprintf.c $(LIBDIR)/startup.o $(DEPLIBS)
516 $(CC) -DTEST $(ILDFLAGS) $(LIBDIR)/startup.o $< -o $@ $(LIBS)
520 -$(RM) $(OBJDIR) *.err $(LIB)
525 # Fix up the deps, these won't end up in $^, but they'll make it work.
526 $(AROS_LIBS)/$(MODULE) : $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(OBJDIR)/shared/arosc_endtag.o
527 $(AROS_LIBS)/$(MODULE) : $(foreach f,$(DEP_LIBS),$(AROS_LIB)/lib$(f).a)
528 $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o: $(AROS_INCLUDES)/sys/syscall.def