Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to design a makefile that will invoke the configure script and then make the library. The commands to build the library are:
./configure <options>
make

What I have tried:

So far I have been piecing the makefile together and have:

$(Name):nettle
.PHONY: nettle
$(Make) --directory=path/to/lib/

Where Name is the name of the top-level application that is dependent on the Nettle library. I'm not sure how to go about using Make to perform the configure which, builds the makefile in the library.
Posted
Updated 5-Nov-20 5:09am
v3
Comments
Richard MacCutchan 5-Nov-20 4:08am    
It is a long time since I have written make files, but you should be able to use the ./configure command as part of the set of commands for a target. Something like:
targetname:
    ./configure
    make makefilename

1 solution

Be aware that configure generally produces a Makefile, so don't use that as your "meta" makefile name. Since this would appear to be a Linux project, you are probably using GNU make, which searches for "GNUmakefile", "makefile" and "Makefile" in that order, so you probably don't want to use those, either.

As far as I know, there's no way to pass option flags to make targets, but GNU make can access global shell variables so you can do something like this:

myMakefile:
CONFOPTS = --prefix=$(HOME)/lib --with-opt-a --with-opt-b

ifdef OPTFOO
    CONFOPTS += --foo=$(OPTFOO)
endif

ifdef OPTBAR
    CONFOPTS += --bar=$(OPTBAR)
endif

mylib:   # as per Ricard, above
     ./configure $(CONFOPTS)
     make


Then you would invoke this as
make -f myMakefile OPTfOO=blah OPTBAR=all
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900