Re: GCC Optimization Levels - Seeking Insights

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Dec 2023, 10:45 Aran Nokan via Gcc-help, <gcc-help@xxxxxxxxxxx>
wrote:

> Hi,
>
> Thank you. I noticed that it is not working with the following error:
>
> No rule to make target 'test.0',
>
>
> So I changed it to this:
>
> $(PROGS): test.% : $(SRC) $(DEPS)
> >         $(CC) -o $@ $(CFLAGS) $(LDLAGS) -O$* $(SRC)
>
>
> But now another problem:
>
> make: *** No rule to make target 'levmarg.c', needed by 'test.0'.  Stop.
> >
>
> Do you have any idea how to fix it?
>

You spelled it wrong. levmarq not levmarq

(N.B. This is not a question about using gcc, this is just about how to
write a working makefile)



>
> > >>>
> > >>> main: $(OBJ)
> > >>>          gcc -o $@ $^ $(CFLAGS) $(LDLAGS)
> > >>>
> > >>> # No optimization
> > >>> main_no_opt: CFLAGS += -O0
> > >>> main_no_opt: $(OBJ)
> > >>>          gcc -o $@ $^ $(CFLAGS) $(LDLAGS)
> > >>>
> > >>> # Basic optimization
> > >>> main_opt1: CFLAGS += -O1
> > >>> main_opt1: $(OBJ)
> > >>>          gcc -o $@ $^ $(CFLAGS) $(LDLAGS)
> > >>>
> > >>> # Moderate optimization
> > >>> main_opt2: CFLAGS += -O2
> > >>> main_opt2: $(OBJ)
> > >>>          gcc -o $@ $^ $(CFLAGS) $(LDLAGS)
> > >>>
> > >>> # High optimization
> > >>> main_opt3: CFLAGS += -O3
> > >>> main_opt3: $(OBJ)
> > >>>          gcc -o $@ $^ $(CFLAGS) $(LDLAGS)
> > >>>
> > >>> # Clean rule
> > >>> clean:
> > >>>          rm -f *.o main main_no_opt main_opt2 main_opt3
> > >>>
> > >>
> > >> Best regards,
> > >> Aran
> > >>
> > >
> >
> >
> >
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux