I’m trying to build JAR files in the
same way as the C library files .a, using archive member capabilities. The
building works fine except that the JAR file is always updated, even if its
members haven’t changed. While .a files are updated only if their members have
changed. Here are the rules I use to do this :
IMG_LST :=
$(wildcard *.BMP *.GIF *.ICO *.JPG *.bmp *.gif *.ico *.jpg)
LIB_IMG_PATH
:= $(imgdir)/$(shell echo "$(CURDIR)" | sed
"s%.*/\([^/]*\)/lib/images\(/.*\)\{0,1\}%libimages_\1.jar%")
LIB_MBR_IMG_LST
= $(IMG_LST:%=$(LIB_IMG_PATH)(%))
$(foreach __name, AR EXE IMG JAR SO,
\
$(eval LIB_$(__name)_LST = $$(sort $$(shell echo
"$$(LIB_MBR_$(__name)_LST)" | sed "s,\([^ ]\)([^)]*.,\1,g"))) \
)
#
The following implicit rule is used only for .a and .jar files whose members
aren’t .class or
.java.
(%): % | $$(@D)
@case "$@" in \
*.jar) \
echo "$<"
| egrep "\.(class|java)$$" || \
$(ECHO) $(JAR) -$$([ -f "$@" ]
&& echo u || echo c)$$(echo "$(JARFLAGS)" | sed "s,[- f],,g")f $@ $<
\
;; \
*.so) \
;; \
*) \
$(ECHO) $(AR)
$(ARFLAGS) $@ $< \
;; \
esac
# Here is an explicit rule
that make libraries (.a, .jar) depend on their attached
members.
$(LIB_IMG_LST) $(LIB_LST): $$(filter address@hidden, $(LIB_MBR_IMG_LST)
$(LIB_MBR_LST))
Does someone have any
idea to resolve this
problem ?