[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clear command in makefile..
From: |
silversurfer |
Subject: |
Re: clear command in makefile.. |
Date: |
3 Jul 2006 05:13:53 -0700 |
User-agent: |
G2/0.2 |
thanks a lot!
Greetings
Tim
Dave Seaman wrote:
> On 3 Jul 2006 03:24:36 -0700, silversurfer wrote:
> > so there is no possibility to do this?
>
> You can make your primary target depend on a phony target that clears the
> screen.
>
> $ cat Makefile
> all: clearscreen main
>
> main:main.o $(ADDOBJS)
> @g++ -o main $(LDFLAGS) $+
>
> .PHONY: clearscreen
>
> clearscreen:
> clear
>
> $ make -n all
> clear
> g++ -c -o main.o main.cc
> g++ -o main main.o
>
>
>
> > Dave Seaman wrote:
> >> 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/>
>
>
>
> --
> Dave Seaman
> U.S. Court of Appeals to review three issues
> concerning case of Mumia Abu-Jamal.
> <http://www.mumia2000.org/>