Hello,

I am trying to create a project containing 3 directories. These
directories generate one archive and two applications. The archive should
be built when using make all, make static or when the archive does not
exist; the other should be built when using make all or make directory.

I use the following makefile:

all: static lib test

exe: $(TARGET_LIB)
        $(MAKE) -C $(TARGET_EXE_DIR)

static $(TARGET_STATIC_LIB):
        $(MAKE) -C $(TARGET_STATIC_DIR)

test: $(TARGET_LIB)
        $(MAKE) -C $(TARGET_TEST_DIR)

This works for a non-parallel build. When using -j2 and
$(TARGET_STATIC_LIB) does not exist the static / $(TARGET_STATIC_LIB) rule
is executed twice.
When the $(TARGET_STATIC_LIB) exists and I try to build the exe or test
only this rule is executed (which is correct).

When I change the dependency of the exe and test rule to static the
archive is only build once, but now the static rule is also executed each
time I want to build exe or test (which I want to avoid, as this is an
long build).

Is it possible to create a Makefile that can do this?

Kind regards,
    Johan Borkhuis

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to