I have several makefiles to build various programs in a software suite (currently 4 programs). I want to create a main Makefile so that I can build everything I need.
Unsure on the way I should proceed, for example using
include fdtc.mk
or calling
$(MAKE) -f ./mk/Makefile nfdtc
Here is a listing of one makefile, the others are similar
A problem I have is how to pass the option from the main makefile to the subdirectory makefile. I do not like using recursive make build systems (example a make in every directory). However, since I have put all the make files in one place together with a main Makefile, I do not see a problem.
I agree in principle. When writing new makefiles, one should write it as one system so it can run efficiently.
When you have to use someone else's makefiles however, you have very little control.
If you're not rewriting them, cramming them all together in one folder is hardly better than keeping them separate. When they were in folders, they were at least organized. Now it's one awful pile.
What option are you trying to pass, to what? If you're not calling make again, there's not a lot to pass options to.
What I did was to have only one makefile for each application and store them in a single folder. Then the main Makefile will execute the appropriate Makefile
I think I have a solution. Let me try it and will report back.
---------- Post updated at 11:32 AM ---------- Previous update was at 11:26 AM ----------
I have no idea why you have done what you have, now. Why bother rewriting it if you're going to do exactly what you said you were trying to avoid? You've got exactly what you had before, except instead of nicely organized into folders, it's one enormous mess.
You might as well have just let them live in their own folders and used their old makefiles. Then you could do this:
all:projectfolder1/projectoutputfile projectfolder2/projectoutputfile ...
projectfolder1/projectoutputfile:projectfolder1/Makefile
make -C projectfolder1
projectfolder2/projectoutputfile:projectfolder2/Makefile
make -C projectfolder2
Then you could do 'make all' and it would run make in each of the folders.
There was a makefile in every subdirectory which together build each program. Now I have just a single makefile for every program, and a main Makefile.
I'm getting you, so I should put them in the directory where the main of each program resides. Is this what your are saying? Can do that. The original was using several libraries to build each program, with each library having its own makefile
Does the following rule create a problem? I have a target nraypk
that calls another makefile raypk.mk to build nraypk. Does the
fact that they have the same name (nraypk) cause a problem?