fix parallel builds

3.3+ngcp2.6
Richard Fuchs 13 years ago
parent 7572ebba2c
commit fc84c5ec4b

@ -60,9 +60,8 @@ ALLDEP+=makecfg.lst
# returns current type: "" core/unknown, "M" module, "L" libray, "U" util
crt_type=$(if $(MOD_NAME),M,$(if $(LIB_NAME),L,$(if $(UTIL_NAME),U)))
cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@
cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \
-o $(NAME)
cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $<
cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH)
ifeq (,$(CC_MKDEP_OPTS))
# if CCC_MKDEP_OPTS is empty => CC cannot generate dependencies on the fly
@ -77,6 +76,21 @@ cmd_CC+=$(CC_MKDEP_OPTS)
cmd_MKDEP=
endif # CC_MKDEP_OPTS
cmd_CC+=-o $@.tmp || rm -f $@.tmp; mv -f $@.tmp $@ 2> /dev/null
cmd_LD+=-o $(NAME).tmp || rm -f $(NAME).tmp; mv -f $(NAME).tmp $(NAME) 2> /dev/null
cmd_CC_lock=while true; do ( flock -n 9 || exit 95; \
$(cmd_CC); \
) 9> $@.lock; exitcode=$$?; test $$exitcode = 95 || break; sleep 1; \
test -e $@ && exit 0; done; \
rm -f $@.lock; exit $$exitcode
cmd_LD_lock=while true; do ( flock -n 9 || exit 95; \
$(cmd_LD); \
) 9> $@.lock; exitcode=$$?; test $$exitcode = 95 || break; sleep 1; \
test -e $@ && exit 0; done; \
rm -f $@.lock; exit $$exitcode
# what will be displayed if quiet==silent
silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@
silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@
@ -107,7 +121,7 @@ module_make= if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \
quote:= "
escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1))
exec_cmd= $(if $($(quiet)_cmd_$(1)),\
@echo "$(call escall,$($(quiet)_cmd_$(1)))" ;) $(cmd_$(1))
@echo "$(call escall,$($(quiet)_cmd_$(1)))" ;) $(cmd_$(1)_lock)
#implicit rules
%.o:%.c $(ALLDEP)

Loading…
Cancel
Save