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

Re: GCC compiler



On 4/29/07, Cédric Lucantis <omer@no-log.org> wrote:
Le dimanche 29 avril 2007 04:56, Micha Feigin a écrit:
> On Sat, 28 Apr 2007 22:20:08 -0300
> "Iuri Sampaio" <iuri.sampaio@gmail.com> wrote:
> > $(BIN): $(OBJS)
> >
> >             $(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(LIBS)
> >

Not really an answer, but this is wrong too, you should have something like
this instead:

OBJS = rotation.o

BIN = rotation

$(BIN): $(OBJS)
        $(CC) -o $@ $^ $(LIBS)

%.o: %.c
        $(CC) -c -o $@ $< $(CFLAGS)

but with only one source file it doesn't really matter

This rule for %.o is, I believe, identical to the implicit rule.  I
always use something like:

SOURCES := rotation.c
or
SOURCES := $(wildcard *.c)

LDFLAGS += $(LIBS)

OBJS := $(patsubst %.c,%.o,$(SOURCES))
BINS := $(patsubst %.o,%,$(OBJS))

default : rotation
or
default : $(BINS)

% : %.o
<tab>$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)

If I'm using GNU make, I hardly ever use "=" instead of ":=", unless I
really want to define a macro.  You're a lot more likely to get what
you expect most of the time, and you can use "+=".

--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
http://36pints.blogspot.com



Reply to: