[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] Makefile



Peter Toft wrote:

> Antag at jeg har
>
> /dir/A/
> /dir/B/
> /dir/C/
>
> og jeg i hvert af de tre kataloger vil lave make clean
> og har en makefile i hvert katalog (A, B og C som kan
> dette). Hvordan  skriver jeg så makefilen til /dir så
> jeg kan skrive make clean der og det skal så køre til
> hvert underkatalog (tilsvarende med make install osv).

#Makefile placed in /dir
.PHONY: default sub clean et_al

default:    sub
    $(local_global_default_targets)

clean:    sub
    $(RM) $(local_global_default_targets)

et_al:    sub
    $(ad_lib)

sub:
    $(MAKE) -C A $(MAKECMDGOALS)
    $(MAKE) -C B $(MAKECMDGOALS)
    $(MAKE) -C D $(MAKECMDGOALS)
#end EX

Så overføres GOALS til makefilerne i de underliggende direktories

Tidligere svar:
Subject:
            Re: [CPROG] Andre problemer med make filer
       Date:
            Wed, 12 Apr 2000 23:52:19 +0200
      From:
            Nils Åke Ljunggren <sslug@sslug>
   Reply-To:
            sslug@sslug
        To:
            sslug@sslug
 References:
            1




jonasbn wrote:

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

Er du i gang med tcPIP? -- jeg kan sikkert hjælpe!
sslug@sslug

> 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?

Den *smarteste* måde skal jeg ikke gøre mig klog på -- heller ikke den
*nemmeste* -- men en nem og forholdsvis smart måde er at lade "sub"
makefiles være dependencies for target og at vidergive
kommandolinie-argumentet til disse:

.PHONY: default sub clean et_al

default:    sub
    $(local_global_default_targets)

clean:    sub
    $(RM) $(local_global_default_targets)

et_al:    sub
    $(ad_lib)

sub:
    $(MAKE) -C server $(MAKECMDGOALS)
    $(MAKE) -C client $(MAKECMDGOALS)
#    cd server && $(MAKE) $(MAKECMDGOALS) hhv.
#    cd client && $(MAKE) $(MAKECMDGOALS) har samme betydning

> 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...

> Jonas

Hej fra Nils!

>
> --
> Peter Toft, Ph.D. sslug@sslug http://www.sslug.dk/~pto
>
> "You don't win a battle by asking, `Will we win?'
> You win it by doing your best to win"
> - Richard M Stallman
>
> ----> Visit http://petition.eurolinux.org <---



 
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] *