Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -1,7 +1,8 @@ # -# Copyright (c) 2007 - 2009, Jonathan Schleifer +# Copyright (c) 2007, 2008, 2009, 2010, 2011 +# Jonathan Schleifer # # https://webkeks.org/hg/buildsys/ # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -97,13 +98,13 @@ .SUFFIXES: .SUFFIXES: .beam .c .c.dep .cc .cc.dep .cxx .cxx.dep .d .erl .lib.o .mo .m .m.dep .mm .mm.dep .o .plugin.o .po .py .pyc .xpm .S .S.dep .PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean locales all: - ${MAKE} ${MFLAGS} subdirs || exit 1 - ${MAKE} ${MFLAGS} depend || exit 1 - ${MAKE} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} locales || exit 1 + ${MAKE} ${MFLAGS} subdirs + ${MAKE} ${MFLAGS} depend + ${MAKE} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} locales subdirs: for i in ${SUBDIRS}; do \ ${DIR_ENTER}; \ ${MAKE} ${MFLAGS} || exit 1; \ @@ -172,16 +173,44 @@ ${LINK_FAILED}; \ fi ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} ${LINK_STATUS} - if ${AR} cr $@ ${OBJS} && ${RANLIB} $@; then \ + rm -f $@ + objs=""; \ + ars=""; \ + for i in ${OBJS}; 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 ${AR} cr $@ $$objs && ${RANLIB} $@; then \ ${LINK_OK}; \ else \ ${LINK_FAILED}; \ rm -f $@; \ - fi + fi; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + done locales: ${MO_FILES} .c.o: ${COMPILE_STATUS}