Hello, trying to use archive rules for jar (placeholder for any kind of archive other than ar archive/ranlib static link library).
---begin Makefile--- #Weird1: Test.jar is remade all the time. #Weird2: Using test.a(object1.o object2.o) directly works, but using Test.jar(Class1.class Class2.class) directly doesn't, it would use ar instead of jar. .PHONY: all #all: Test.jar(Class1.class Class2.class) test.a(object1.o object2.o) all: Test.jar test.a Test.jar: Test.jar(Class1.class Class2.class) test.a: test.a(object1.o object2.o) # Warning: This has a race condition, it might lead to jar cf being called concurrently if make -j is used. # A possible solution is to use ljar https://github.com/christianhujer/ljar #%.jar: AR:=ljar #%.jar: ARFLAGS:=uf %.jar: AR:=jar %.jar: ARFLAGS=$(if $(wildcard $@),u,c)f %.class: %.java javac $^ %.java: echo "public class $* {}" >$@ #Weird3: Using %.c instead of explicit names will lead to make trying to build a file named "Test.jar(Class1.class).c" object1.c object2.c: echo "void $*(void) {}" >$@ .PHONY: clean clean: $(RM) *.jar *.a *.class *.o *.c *.java ---end Makefile--- While Weird2 and Weird3 could be worked around in the Makefile, I cannot find a workaround for Weird1: I run make, I run make again, and while it doesn't touch test.a (expected), it remakes Test.jar (unexpected). Am I doing something wrong? Is this a bug? Or am I trying to use the archive feature in a not (yet?) supported way? I'm using GNU Make 4.0. Best regards, Christian Hujer _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make