I am autoconfiscating a moderately large legacy project. A previously existing methodology in the project is to create a large number of .c and .h files by generating them with a script from a template. I have created custom rules to do this and all builds fine. I originally put the generated files into CLEANFILES since they are generated files.
But upon a clean build I notice that it takes longer to run the scripts to build those .c and .h files than it takes to compile the entire rest of the project! Yes the scripts are slow and I can probably speed them up. But for now I just want to work around the problem and put that task off until later. The files are architecture independent and produce identical files on any platform. Therefore I would like to include those into the distribution in order to save the rebuild time every time I recompile from scratch. I have been thinking I should put the generated .c and .h files into both EXTRA_DIST and MAINTAINERCLEANFILES. Then I could force a rebuild of those with maintainer-clean when I really want to force rebuild them. They would get normal dependency management and be rebuilt when needed based upon their dependencies changing. But they would avoid being rebuilt gratuitously. I have tested this and it seems to do what I want but seems questionable to me. I was looking for direction. Does this scheme sound right? For comparison how are lex and yacc intermediate .c and .h files handled? I think my problem is similar should be handled similarly. I will include an example structure at the end of this message. It is functional and representative of the problem. And perhaps someone will see obvious improvements to which I am blind. Thanks Bob Here is an example: EXTRA_DIST = file1.d file1.h file1.c ../../include/file1.h ../../src/file1.c MAINTAINERCLEANFILES = file1.h file1.c ../../include/file1.h ../../src/file1.c all: $(MAINTAINERCLEANFILES) file1.c: file1.d a_script file1.d file1.h: file1.d a_script file1.d ../../src/file1.c: file1.c cp file1.c ../../src/ ../../include/file1.h: file1.h cp file1.h ../../include/