|
@@ -6,9 +6,18 @@
|
|
#
|
|
#
|
|
|
|
|
|
#
|
|
#
|
|
-# Uses: NAME, ALLDEP, CC, CFLAGS, DEFS, INCLUDES, LIBS, MKDEP, auto_gen, auto_gen_others,
|
|
|
|
-# depends, objs, extra_objs, static_modules, static_modules_path
|
|
|
|
|
|
+# Uses: NAME, ALLDEP, CC, CFLAGS, DEFS, INCLUDES, LIBS, MKDEP, auto_gen,
|
|
|
|
+# auto_gen_others, depends, objs, extra_objs, static_modules,
|
|
|
|
+# static_modules_path, LD_RPATH
|
|
# (all this must be defined previously!, see Makefile.defs & Makefile)
|
|
# (all this must be defined previously!, see Makefile.defs & Makefile)
|
|
|
|
+# Optional: SER_LIBS - list of ser libraries that will be automatically
|
|
|
|
+# built if necessary. Format: path/shortname, where shortname is the
|
|
|
|
+# name passed to -l (e.g. for libprint.so the shortname is print)
|
|
|
|
+#
|
|
|
|
+# History:
|
|
|
|
+# --------
|
|
|
|
+# 2007-03-29 set rpath differently for make install
|
|
|
|
+# automatically build listed SER_LIBS if needed (andrei)
|
|
#
|
|
#
|
|
|
|
|
|
|
|
|
|
@@ -22,20 +31,49 @@
|
|
| sed 's#\(\($*D)\)\?$(*F)\)\.o[ :]*#$*.o $@ : #g' > $@; \
|
|
| sed 's#\(\($*D)\)\?$(*F)\)\.o[ :]*#$*.o $@ : #g' > $@; \
|
|
[ -s $@ ] || rm -f $@
|
|
[ -s $@ ] || rm -f $@
|
|
|
|
|
|
-# use RPATH and SER_LIBS if needed
|
|
|
|
|
|
+# use RPATH and SER_LIBS if needed (make install and the module depends
|
|
|
|
+# on some ser libs)
|
|
|
|
+
|
|
ifneq ($(SER_LIBS),)
|
|
ifneq ($(SER_LIBS),)
|
|
ifneq ($(LD_RPATH),)
|
|
ifneq ($(LD_RPATH),)
|
|
-SER_RPATH:=$(LD_RPATH)$(lib-target)
|
|
|
|
|
|
+ifneq (,$(filter install, $(MAKECMDGOALS)))
|
|
|
|
+SER_RPATH_LST:=$(lib-target)
|
|
|
|
+else
|
|
|
|
+SER_RPATH_LST:=$(realpath $(dir $(SER_LIBS)))
|
|
|
|
+endif
|
|
|
|
+ifneq ($(strip $(SER_RPATH_LST)),)
|
|
|
|
+SER_RPATH:=$(addprefix $(LD_RPATH),$(SER_RPATH_LST))
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+ALL_LIBS=$(LIBS)
|
|
|
|
+
|
|
|
|
+ifneq ($(SER_LIBS),)
|
|
|
|
+-include librpath.lst
|
|
|
|
+ifneq ($(SER_RPATH_LST), $(LIB_RPATH_LST))
|
|
|
|
+$(shell rm -f librpath.lst)
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+SER_LIBS_DEPS:= \
|
|
|
|
+ $(foreach l, $(SER_LIBS), $(dir $l)$(LIB_PREFIX)$(notdir $l)$(LIB_SUFFIX))
|
|
|
|
+ALL_LIBS+=$(foreach l, $(SER_LIBS), -L$(dir $l) -l$(notdir $l))
|
|
|
|
+
|
|
|
|
+$(NAME): $(SER_LIBS_DEPS) librpath.lst
|
|
|
|
|
|
-ALL_LIBS=$(LIBS) $(SER_LIBS)
|
|
|
|
|
|
+$(SER_LIBS_DEPS):
|
|
|
|
+ $(MAKE) -C $(dir $@)
|
|
|
|
+
|
|
|
|
+endif
|
|
|
|
|
|
# normal rules
|
|
# normal rules
|
|
$(NAME): $(objs) $(ALLDEP)
|
|
$(NAME): $(objs) $(ALLDEP)
|
|
$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) -o $(NAME)
|
|
$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) -o $(NAME)
|
|
|
|
|
|
|
|
|
|
|
|
+librpath.lst: $(ALLDEP)
|
|
|
|
+ @echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst
|
|
|
|
+
|
|
.PHONY: all
|
|
.PHONY: all
|
|
all: $(NAME) modules
|
|
all: $(NAME) modules
|
|
|
|
|
|
@@ -47,7 +85,7 @@ static: $(objs)
|
|
|
|
|
|
.PHONY: clean
|
|
.PHONY: clean
|
|
clean:
|
|
clean:
|
|
- -@rm -f $(objs) $(NAME) $(objs:.o=.il) 2>/dev/null
|
|
|
|
|
|
+ -@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null
|
|
-@for r in $(modules) $(static_modules_path) "" ; do \
|
|
-@for r in $(modules) $(static_modules_path) "" ; do \
|
|
if [ -d "$$r" ]; then \
|
|
if [ -d "$$r" ]; then \
|
|
echo "module $$r" ; \
|
|
echo "module $$r" ; \
|