On 1 Jul 2006 09:37:59 -0700, silversurfer wrote: > Hello world, > I was just wondering why the clear-line in my Makefile does not work:
> main:main.o $(ADDOBJS) > clear > @g++ -o main $(LDFLAGS) $+ > As far as I understood it, it should be possible to add multiple > shell-commands.. Nevertheless, this does compile the files, but the > 'clear' before does not work.. > Anyone knows why? > PS I would like to use this because I like having a clean screen with > the actual errors on it.. for me, it is easier... ;) The "clear" command actually does work, but it's not necessarily the first thing that gets generated when you run "make". It only gets generated when that particular rule is applied, and that rule is not what causes the program to be compiled. You can type "make -n" to have the generated sequence of commands echoed to the screen without being executed. If you have, say, a main.cc file plus a Makefile containing exactly those three lines quoted above, you will see the following: $ make -n g++ -c -o main.o main.cc clear g++ -o main main.o The reason for this is that you didn't actually specify a compile command in your Makefile, but only a link command. You said "main" depends on "main.o", but you didn't give a rule for generating "main.o". The "make" program supplied the compile command for you from its implicit rulebase, thus generating "main.o" for you. Once the prerequisite (main.o) was satisfied, "make" was able to proceed by applying your rule for the link step. -- Dave Seaman U.S. Court of Appeals to review three issues concerning case of Mumia Abu-Jamal. <http://www.mumia2000.org/> _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus