« Return to Thread: Help on Makefile

Re: Help on Makefile

by Paul Smith-20 :: Rate this Message:

| View in Thread

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 $<





_______________________________________________
Help-make mailing list
Help-make@...
https://lists.gnu.org/mailman/listinfo/help-make

 « Return to Thread: Help on Makefile