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 := -Iinclude -I$(TOP)/rom/exec
11 # We are trying to build:
12 # $(AROS_LIBS)/arosc.library from $(SHARED)
13 # $(AROS_LIB)/libarosc.a from $(COMMON) and $(STUBS)
15 # It turns out that some of $(SHARED) refer to things in $(COMMON), so
16 # I've put that into the arosc.library as well.
17 MODULE := arosc.library
18 SHARED_LIB := $(AROS_LIB)/libarosc.a
20 # New: Also trying to build
21 # $(AROS_LIB)/librom.a from $(COMMON) and $(ROMONLY)
23 # This is a library that is allowed to be used inside modules and the
24 # kernel. It must include no code which refers to global variables.
26 # Currently the main difference is that it includes a different __assert()
27 # function to handle asserts in the kernel.
28 ROM_LIB := $(AROS_LIB)/librom.a
31 LIB := $(SHARED_LIB) $(ROM_LIB) $(AROS_LIBS)/$(MODULE)
34 # - Common always exist in the link library.
90 # - Shared are in either the shared linklib, or the arosc.library module
342 # Objects for rom.lib, from the static build.
371 # - The stubs are generated, and are in the shared link library.
372 STUBS := $(wildcard $(OBJDIR)/stubs/*.o)
375 DEPS := $(foreach f,$(COMMON),$(OBJDIR)/$(f).d) \
376 $(foreach f,$(SHARED),$(OBJDIR)/shared/$(f).d) \
377 $(OBJDIR)/shared/arosc_init.d $(OBJDIR)/shared/arosc_functable.d \
378 $(OBJDIR)/shared/arosc_endtag.d
380 COMMON_OBJ := $(foreach f,$(COMMON),$(OBJDIR)/$(f).o) \
381 $(foreach f,$(COMMON_ARCH),$(OBJDIR)/arch/$(f).o)
383 SHARED_OBJ := $(COMMON_OBJ) $(STUBS) $(OBJDIR)/arosc_autoinit.o
385 MODULE_OBJ := $(foreach f, $(SHARED), $(OBJDIR)/shared/$(f).o)
387 ROM_OBJ := $(foreach f,$(ROM_ONLY),$(OBJDIR)/rom/$(f).o) \
388 $(foreach f,$(ROM_COMMON),$(OBJDIR)/$(f).o) \
389 $(foreach f,$(ROM_COMMON_ARCH),$(OBJDIR)/arch/$(f).o) \
390 $(foreach f,$(ROM_STATIC),$(OBJDIR)/static/$(f).o)
392 # These are added to the link step of arosc.library
393 LIBS := -L$(AROS_LIB) -larosm -lautoinit
394 DEP_LIBS := arosm autoinit
396 #MM- linklibs-core : linklibs-clib
397 #MM- linklibs : linklibs-clib
398 #MM linklibs-clib : setup-clib includes linklibs-mlib linklibs-autoinit \
402 linklibs-clib-quick : linklibs-clib
404 linklibs-clib : setup-clib $(SHARED_LIB) $(ROM_LIB) $(AROS_LIBS)/$(MODULE)
406 $(OBJDIR)/libarosccommon.a: $(COMMON_OBJ)
409 $(SHARED_LIB) : $(SHARED_OBJ)
412 $(ROM_LIB) : $(ROM_OBJ)
415 $(AROS_LIBS)/$(MODULE) : $(MODULE_OBJ) $(OBJDIR)/libarosccommon.a
417 objs="$(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(MODULE_OBJ)" \
418 endtag="$(OBJDIR)/shared/arosc_endtag.o" \
419 ldflags="$(LDFLAGS) -L$(OBJDIR) $(NOSTDLIB_LDFLAGS)" \
420 libs="$(LIBS) -larosccommon"
422 $(OBJDIR)/static/%.o : %.c
423 %compile_q opt="$(CFLAGS)"
425 $(OBJDIR)/shared/%.o : %.c
426 %compile_q opt="$(CFLAGS) -DAROSC_SHARED"
428 $(OBJDIR)/rom/%.o : %.c
429 %compile_q opt="$(CFLAGS)"
432 %compile_q opt="$(CFLAGS)"
434 # Need to copy these files in from the machine dependant build.
435 $(OBJDIR)/shared/%jmp.o : $(OBJDIR)/%jmp.o
438 # The rules to create the dependancy files.
439 $(OBJDIR)/static/%.d : %.c
440 %mkdepend_q flags=$(CFLAGS)
442 $(OBJDIR)/shared/%.d : %.c
443 %mkdepend_q flags="$(CFLAGS) -include __arosc_privdata.h"
445 $(OBJDIR)/rom/%.d : %.c
446 %mkdepend_q flags=$(CFLAGS)
449 %mkdepend_q flags=$(CFLAGS)
453 %mkdirs_q $(AROS_INCLUDES)/sys $(OBJDIR)
454 %mkdirs_q $(OBJDIR)/static $(OBJDIR)/shared $(OBJDIR)/rom
455 %mkdirs_q $(AROS_LIB) $(AROS_LIBS)
458 check : $(TESTDIR)/snprint
460 $(TESTDIR)/snprintf : snprintf.c $(LIBDIR)/startup.o $(DEPLIBS)
461 $(CC) -DTEST $(ILDFLAGS) $(LIBDIR)/startup.o $< -o $@ $(LIBS)
465 -$(RM) $(OBJDIR) *.err $(LIB)
470 # Fix up the deps, these won't end up in $^, but they'll make it work.
471 $(AROS_LIBS)/$(MODULE) : $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o $(OBJDIR)/shared/arosc_endtag.o
472 $(AROS_LIBS)/$(MODULE) : $(foreach f,$(DEP_LIBS),$(AROS_LIB)/lib$(f).a)
473 $(OBJDIR)/shared/arosc_init.o $(OBJDIR)/shared/arosc_functable.o: $(AROS_INCLUDES)/sys/syscall.def