Path: chuka.playstation.co.uk!news From: "Martin Keates" Newsgroups: scee.yaroze.freetalk.english Subject: Re: GCC (sorry) Date: Tue, 6 Mar 2001 21:16:28 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 69 Message-ID: <983k1m$7f3@www.netyaroze-europe.com> References: <983afi$7f2@www.netyaroze-europe.com> NNTP-Posting-Host: modem-230.neon.dialup.pol.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Makefiles are a beast unto themselves... But, basically you want a file called "Makefile" or "makefile" containing some rules for compilation like this: : : and so on. rulenames can be anything like lib or prog or all so "make lib" does that rule. "make all" or "make" will do the "all" rule if there is one. dependencies are filenames (my_file.c, my_file.h, my_file.o) or other rulenames in the makefile (so rules can be dependent on other rules). the is important. Just put a tab, and only one before rule actions. Rule actions are just commands, like: gcc -O3 proggy.c -o proggy That's basically enough to work with, but you can use shell variables as well. Here you just right something like: CFLAGS = -O3 -Wall and then anywhere else in the makefile put $(C_FLAGS) which will be interpretted as "-O3 -Wall". I've attached a Makefile for one of my projects. It's about as complex as a yaroze makefile needs to be (i.e. not very complex at all really). A couple of variables, and four rules. When make runs, it checks "all", which is dependent on "banjo" which is dependent on "banjo.o" and "pad.o" which are dependent on the source code files. If the source code changes, the object files are rebuilt. If an object file changes, the executable is relinked. Makefiles have a lot more functionality than this, and can be hideously more complex... Blimey - that all looks confusing now I look back at it. Oh well. :) Anyway, as long as "gcc" and "make" and the other GNU tools off the yaroze disk are in your PATH that's all the setting up you need (for compilation at least). Martin. begin 666 Makefile.dat M0U]&3$%'4R @/2 M3S,@+5=A;&P-"DQ)3DM%4B @/2 M6&QI;FME