From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,163994d4f34e92d0 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.72.165 with SMTP id e5mr1617310pav.4.1344323817801; Tue, 07 Aug 2012 00:16:57 -0700 (PDT) Path: g9ni3093299pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!ctu-gate!news.nctu.edu.tw!usenet.stanford.edu!panix!newsfeed-00.mathworks.com!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: how to tell gnatmake to send executables to a different directory when compiling multi source? Date: Mon, 30 Jul 2012 17:05:26 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <214bbd15-f7cb-4710-a6a7-64f37923bf4e@googlegroups.com> <87wr1moexq.fsf@ludovic-brenta.org> <87sjcaoa08.fsf@ludovic-brenta.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1343682326 10510 192.74.137.71 (30 Jul 2012 21:05:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 30 Jul 2012 21:05:26 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:XZSGOKFJ3EJekl43hMD9PAOb8Ds= Content-Type: text/plain; charset=us-ascii Date: 2012-07-30T17:05:26-04:00 List-Id: "Nasser M. Abbasi" writes: > Make is only used here as a 'wrapper' around gnatmake. gnatmake is > the one doing the real work. Only reason to use Make is really just > so that to avoid using bash scripts and to also allow recusrive make > to work (so that I can write make from the top of the tree and > have things build). The make file you show below looks perfectly reasonable to me. It's simple, and is not recursive. If you don't want to waste time learning gnatmake/gprbuild/project files, and you don't need that functionality, this is a reasonable approach. But I don't understand your reference to "recursive make" above. You don't need recursive make in order to do "make" from the top of the tree and build everything. If your Ada files are scattered all over a bunch of subdirectories, you can just mention those directories with the -I switch. If you have C files mixed in, that doesn't change things -- you still don't need recursive make. This make file doesn't put the executables where you wanted them, but it's not hard to write some rules that will copy or move them, or create links. But I advise you to not let your make files get complicated, and try to avoid recursive make. The paper somebody mentioned explains why recursive make causes trouble, and why you don't need it. > Here is a simple example. Assume you have a folder with 2 main files > (main1.adb and main2.adb) and want to build them, and they depend on > other ada packages in another folder(s). > > Then put this Makefile in the folder with the main ada files > > -------------------------------------- > EXECUTABLE=main1 main2 > > .PHONY: all > all: ${EXECUTABLE} > > .PHONY: FORCE > > ${EXECUTABLE}: FORCE > gnatmake -I../binding $@.adb -largs -L/usr/lib -lblas -llapack > > FORCE: > > clean: > -rm ${EXECUTABLE} > -rm *.ali > -rm *.o > ---------------------------- - Bob