[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Andre problemer med make filer



In article xxx you wrote:

> Jeg har problemer med noget makefil sammenhæng. Jeg har to uafhængige C
> programmer, og tre make filer:

> 	./Makefile
> 	./server/Makefile
> 	./client/Makefile

> Hvordag får jeg på den smarteste måde lavet en afhængighed så når man
> kører top-level makefilen checker den, og evt. kører, de andre
> Makefiler automatisk?

> Jeg har kigget i Gnu Make manualen, og der lader til at være mange
> uafhængigheder, så jeg har svært ved at vælge...

"info make" giver egentlig svaret på det hele (et eller andet sted)

Det nemmeste er blot at kalde "make" i subkataloget fra den førsye
makefil, og sådan at variable mv. arves.

Men muligvis er du også interesseret i "depencies" og både gcc og
g++ kan lave disse med :

    $(CXX) -MM ${CFLAGS} $(SRCFILES) > .dependencies

Denne skal dog så flettes ind i Makefile eller sidst med include.
Det bøvlede bliver at få fuld path på alle filer, hvis det er nødvendigt.
Bedre er måske at strukturer includepath og lib-path mv. til ens project.

Jeg har f.eks. :

OST= $(shell uname -s)
TODAY= $(shell date +%Y%m%d)
ifeq ($(OST),Linux)
 OSTARGET:=UNIX
else
 ifeq ($(findstring CYGWIN,$(OST)),CYGWIN)
   OSTARGET:=CYGWIN
 endif
endif

# OSTARGET arves så af makefile i underkataloger
......

mitprogram:	mitprogram.o mitlib.o parsers/parsers.a
        ......

......

parsers/parsers.a:
        $(MAKE) -C parsers
....

clean:  
        rm -f *.o *~ \#*\#
        $(MAKE) clean -C parsers

include .dependencies


-- 
mvh Frank Damgaard  | http://home3.inet.tele.dk/frda/



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *