[Top][All Lists]

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

Using grep inside makefile for loop

From: givemecode
Subject: Using grep inside makefile for loop
Date: Mon, 17 Jan 2011 10:28:11 -0800 (PST)

I saw this question was posted but never answered on this forum. Hopefully
this can be done:

I have code in a makefile that creates a new file called "allheaders.h"
which includes ALL the headers, and is intended to verify they compile:

allheaders.h $(HEADER)
    @for f in $(HEADER) ; do echo "#include \""$$f"\"" >> $@ ; done

where HEADER is just a bunch of header files inside the include directory:

HEADER = include/a.h
HEADER += include/b.h
HEADER += include/c.h

How do I do something similar to grep in the for loop, so as not to include
the "include/" part of the header rule?

For instance, I currently have this inside my allheaders.h file:

#include "include/a.h"
#include "include/b.h"
#include "include/c/h"

but I want just:

#include "a.h"
#include "b.h"

they are essential the same but I would like it to be the second list.
View this message in context:
Sent from the Gnu - Make - Help mailing list archive at

reply via email to

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