List Info

Thread: make: config file for library linking




make: config file for library linking
country flaguser name
United States
2008-03-02 03:37:36
Hello,
I have implemented the Makefile what automatically search
the given 
directory and build up the executables (.exe) from the
source codes.

%.exe:%.o
	$(CC) $(LIB_FLAG) $< $(TEST_LIB) -o $ 
$(STANDART_LIB)

%.o:%.cpp
	$(CC) -c $(CCFLAGS) -I $(INCLUDE_DIR)  $< -o ./$

Now I would like to add the possibility that for each .cpp
file is a 
special config file in the same directory as the .cpp file
what 
determines what libraries should be linked to the
executable.
Do you have any idea or experiences?
Thank you a lot.
Have a nice day
Martin

Re: make: config file for library linking
country flaguser name
Sweden
2008-03-02 15:11:52
Martin Vcelak <mvcelakgmail.com> wrote:
> Now I would like to add the possibility that for each
.cpp file is a 
> special config file in the same directory as the .cpp
file what 
> determines what libraries should be linked to the
executable.
> Do you have any idea or experiences?

This sounds a bit like the dependency files that are
possibly to create
with the -MM flag for gcc, those files contain makefile
rules to keep
track of dependencies of .h files. Usually make does includ
on such files.

One way to solve your problem would be to include your
config files in
Makefile, something like this:

include $(wildcard *.conf)

And each .conf file would have a line looking something like
this:

LDFLAGS += -lm -lX11

regards Henrik
-- 
The address in the header is only to prevent spam. My real
address is:
hc3(at)poolhem.se Examples of addresses which go to
spammers:
rootlocalhost postmasterlocalhost


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )