[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help on Makefile
From: |
Paul Smith |
Subject: |
Re: Help on Makefile |
Date: |
Tue, 08 May 2012 08:58:05 -0400 |
On Mon, 2012-05-07 at 21:25 -0700, lucky7456969 wrote:
> Code:
>
> all : $(SOURCES)
> $(CC) $(CFLAGS) -o $(OBJECTS) $(SOURCES)
>
> Code:
>
> SOURCES = libiberty/alloca.c \
> libiberty/argv.c \
> libiberty/asprintf.c \
> libiberty/atexit.c \
>
> ...
>
> Code:
>
> OBJECTS = debug/libiberty/alloca.o \
> debug/libiberty/argv.o \
> debug/libiberty/asprintf.o \
> debug/libiberty/atexit.o \
> debug/libiberty/basename.o \
> debug/libiberty/bcmp.o \
> debug/libiberty/bcopy.o \
> debug/libiberty/bsearch.o \
>
> if i have such a build rule as this is, the whole OBJECTS and SOURCES will
> be compiled in a single batch. How do I compile them separately? I have
> googled, but already spent too much time on it
Try:
OBJECTS = debug/libiberty/alloca.o ...
all: $(OBJECTS)
debug/libiberty/%.o : libiberty/%.c
$(CC) $(CFLAGS) -o $@ -c $<