[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ifeq and ifneq not working

From: Sedrubal
Subject: ifeq and ifneq not working
Date: Sat, 23 Apr 2016 17:26:32 +0200


I'm not sure but I think I found a bug in ifeq and ifneq:

My project structure is like this:

$ tree
├── Makefile
├── subprojA
│   ├── src.cpp
│   ├── Makefile
│   └── test.cpp
└── subprojA
    ├── src.cpp
    ├── Makefile
    └── test.cpp

The upper Makefile should run `make test` for each sub project if "test.cpp" is 
in this folder.

My Makefile is like this:

SUBDIRS := $(wildcard */)
TESTDIRS        := $(SUBDIRS:%=test-%)


all: $(SUBDIRS)

test: $(TESTDIRS)

        CC=$(CC) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) all -C $@

        $(eval TARGETDIR := $(@:test-%=%))
        $(eval TESTSRC := $(TARGETDIR)test.cpp)
        @echo "$(wildcard $(TESTSRC))" # <-- prints subproj{A,B}/test.cpp if it 
exists -> this is working
ifneq ("$(wildcard $(TESTSRC))","")
        @#file exists --> but even if the test src exists, this will never be 
        CC=$(CC) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) test -C 
        @echo "[i] $(TARGETDIR) has no tests..."

Can you explain, why this shouldn't work? Is this a bug or only a fail in 
Makefile logic?

Best regards and grml,


Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]