Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -102,24 +102,25 @@ OBJS10 = ${OBJS9:.rc=.o} OBJS11 = ${OBJS10:.S=.o} OBJS += ${OBJS11:.xpm=.o} LIB_OBJS = ${OBJS:.o=.lib.o} +MORPHOS_LIB_OBJS = ${OBJS:.o=.moslib.o} PLUGIN_OBJS = ${OBJS:.o=.plugin.o} MO_FILES = ${LOCALES:.po=.mo} .SILENT: .SUFFIXES: -.SUFFIXES: .beam .c .c.dep .cc .cc.dep .class .cxx .cxx.dep .d .erl .lib.o .java .mo .m .m.dep .mm .mm.dep .o .plugin.o .po .py .pyc .rc .S .S.dep .xpm +.SUFFIXES: .beam .c .c.dep .cc .cc.dep .class .cxx .cxx.dep .d .erl .lib.o .java .mo .m .m.dep .mm .mm.dep .moslib.o .o .plugin.o .po .py .pyc .rc .S .S.dep .xpm .PHONY: all subdirs subdirs-after pre-depend depend install install-extra uninstall uninstall-extra clean distclean locales ${SUBDIRS} ${SUBDIRS_AFTER} all: ${MAKE} pre-all ${MAKE} subdirs ${MAKE} depend - ${MAKE} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} ${JARFILE} locales + ${MAKE} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${MORPHOS_LIB} ${MORPHOS_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} ${JARFILE} locales ${MAKE} subdirs-after ${MAKE} post-all pre-all post-all: @@ -185,31 +186,31 @@ fi; \ fi .c.c.dep: ${CPP} ${CPPFLAGS} ${CFLAGS} -M $< | \ - sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ + sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.moslib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .cc.cc.dep .cxx.cxx.dep: ${CPP} ${CPPFLAGS} ${CXXFLAGS} -M $< | \ - sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ + sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.moslib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .m.m.dep: ${CPP} ${CPPFLAGS} ${OBJCFLAGS} -M $< | \ - sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ + sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.moslib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .mm.mm.dep: - ${CPP} ${CPPFLAGS} ${OBJCXXFLAGS} -M $< | \ - sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ + ${CPP} ${CPPFLAGS} ${OBJCPPFLAGS} -M $< | \ + sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.moslib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .S.S.dep: ${CPP} ${CPPFLAGS} ${ASFLAGS} -M $< | \ - sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ + sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.moslib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } pre-depend: ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA} @@ -263,10 +264,46 @@ done; \ cd ..; \ done; \ if ${LD} -o $@ $$objs ${LIB_LDFLAGS} ${LDFLAGS_INSTALL_NAME} ${LDFLAGS} ${LIBS}; then \ ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + fi; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + done + +${MORPHOS_LIB} ${MORPHOS_LIB_NOINST}: ${EXT_DEPS} ${MORPHOS_LIB_OBJS} ${MORPHOS_LIB_OBJS_EXTRA} + ${LINK_STATUS} + out="$@"; \ + objs=""; \ + ars=""; \ + for i in ${MORPHOS_LIB_OBJS} ${MORPHOS_LIB_OBJS_EXTRA}; do \ + case $$i in \ + *.a) \ + ars="$$ars $$i" \ + ;; \ + *.o) \ + objs="$$objs $$i" \ + ;; \ + esac \ + done; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + mkdir -p $$dir; \ + cd $$dir; \ + ${AR} x ../$$i; \ + for j in *.o; do \ + objs="$$objs $$dir/$$j"; \ + done; \ + cd ..; \ + done; \ + if ${LD} -o $@ $$objs -nostartfiles ${LDFLAGS} ${LIBS}; then \ + ${LINK_OK}; \ else \ ${LINK_FAILED}; \ fi; \ for i in $$ars; do \ dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ @@ -403,10 +440,19 @@ if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi +.c.moslib.o: + ${COMPILE_MOSLIB_STATUS} + in="$<"; \ + out="$@"; \ + if ${CC} -mbaserel32 ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -c -o $@ $<; then \ + ${COMPILE_MOSLIB_OK}; \ + else \ + ${COMPILE_MOSLIB_FAILED}; \ + fi .c.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -c -o $@ $<; then \ @@ -431,10 +477,19 @@ if ${CXX} ${LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi +.cc.moslib.o .cxx.moslib.o: + ${COMPILE_MOSLIB_STATUS} + in="$<"; \ + out="$@"; \ + if ${CXX} -mbaserel32 ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$@} -c -o $@ $<; then \ + ${COMPILE_MOSLIB_OK}; \ + else \ + ${COMPILE_MOSLIB_FAILED}; \ + fi .cc.plugin.o .cxx.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ if ${CXX} ${PLUGIN_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$@} -c -o $@ $<; then \ @@ -497,10 +552,19 @@ if ${OBJC} ${LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi +.m.moslib.o: + ${COMPILE_MOSLIB_STATUS} + in="$<"; \ + out="$@"; \ + if ${OBJC} -mbaserel32 ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$@} -c -o $@ $<; then \ + ${COMPILE_MOSLIB_OK}; \ + else \ + ${COMPILE_MOSLIB_FAILED}; \ + fi .m.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ if ${OBJC} ${PLUGIN_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$@} -c -o $@ $<; then \ @@ -525,10 +589,19 @@ if ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi +.mm.moslib.o: + ${COMPILE_MOSLIB_STATUS} + in="$<"; \ + out="$@"; \ + if ${OBJCXX} -mbaserel32 ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ + ${COMPILE_MOSLIB_OK}; \ + else \ + ${COMPILE_MOSLIB_FAILED}; \ + fi .mm.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ if ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ @@ -565,11 +638,11 @@ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ fi -.S.o: +.S.o .S.moslib.o: ${COMPILE_STATUS} in="$<"; \ out="$@"; \ if ${AS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_OK}; \ @@ -611,10 +684,19 @@ if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -x c -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi +.xpm.moslib.o: + ${COMPILE_MOSLIB_STATUS} + in="$<"; \ + out="$@"; \ + if ${CC} -mbasel32 ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -x c -c -o $@ $<; then \ + ${COMPILE_MOSLIB_OK}; \ + else \ + ${COMPILE_MOSLIB_FAILED}; \ + fi .xpm.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$@} -x c -c -o $@ $<; then \ @@ -874,10 +956,13 @@ COMPILE_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@.@TERM_SGR0@\n" "$<" COMPILE_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@!@TERM_SGR0@\n" "$<"; exit $$err COMPILE_LIB_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@ (lib)...@TERM_SGR0@\r" "$<" COMPILE_LIB_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@ (lib).@TERM_SGR0@\n" "$<" COMPILE_LIB_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@ (lib)!@TERM_SGR0@\n" "$<"; exit $$err +COMPILE_MOSLIB_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@ (moslib)...@TERM_SGR0@\r" "$<" +COMPILE_MOSLIB_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@ (moslib).@TERM_SGR0@\n" "$<" +COMPILE_MOSLIB_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@ (moslib)!@TERM_SGR0@\n" "$<"; exit $$err COMPILE_PLUGIN_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@ (plugin)...@TERM_SGR0@\r" "$<" COMPILE_PLUGIN_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@ (plugin).@TERM_SGR0@\n" "$<" COMPILE_PLUGIN_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@ (plugin)!@TERM_SGR0@\n" "$<"; exit $$err LINK_STATUS = printf "@TERM_EL@@TERM_SETAF3@Linking @TERM_BOLD@$@@TERM_SGR0@@TERM_SETAF3@...@TERM_SGR0@\r" LINK_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully linked @TERM_BOLD@$@@TERM_SGR0@@TERM_SETAF2@.@TERM_SGR0@\n"