[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dependencies and other issues with generated files
From: |
David Sveningsson |
Subject: |
Dependencies and other issues with generated files |
Date: |
Wed, 27 Jun 2012 18:13:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
Hi,
I'm having some problems when generating source files. I have written a
tool which generates both a c source-file, a header and dependencies of
the source, all at the same time using a single command.
After stripping of the flags my rules basically look like this:
SUFFIXES = .foo
app_SOURCES = test.foo main.c
.foo.c:
./mytool -f $< -e $(basename $@).h -o $@
(main.c includes test.h)
The first problem I'm having is that test.h may not have been built when
compiling main.c (especially if using parallel build). I guess a
workaround would be to add a dependency like "main.c: test.c". Is there
a way to handle this dependency in a more automatic way?
Secondly if test.foo is in a subdirectory and I'm doing an out-of-tree
build the folder does not exist. Is there a way to automatically create
the required folders or rename the file similar to object files (e.g.
myapp-main.o)? I got it working using "@test -e $(dir $@) || mkdir -p
$(dir $@)", which I guess would be fine but it also seems like a hack to me.
Next I'm having issues when cleaning. I would like "make clean" to
remove the generated files. I was expecting at least test.c to be
cleaned automatically but none of the generated files was removed.
Manually adding to CLEANFILES or clean-local is tiresome and error-prone.
I have control of the generator source code but it is meant to be used
without having the source in tree. I could split the header generation
into a separate step but as it mean the source has to be parsed and
prepared multiple times I would prefer to keep it as a single command.
In the end, I'd like my (.foo) sources to behave very similar to a
regular c-file (from the users perspective).
- Dependencies and other issues with generated files,
David Sveningsson <=