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

Re: Makefile question??



On 9/10/07, ISHWAR RATTAN <rattan@cps.cmich.edu> wrote:
> CC   = gcc
> SRCS = a.c b1.c c1.c
> OBJS = $(addsuffix .o, $(basename $(SRCS) .c))
>
> target: $(OBJS)
>         $(CC) $(LDFLAGS) $(OBJS) -o target
>
> somehow make does not like the line that sets up OBJS
> says that no rules to make target found but if replaced
> as
> OBJS = a.o b1.o c1.o
>
> it works!
>
> Any pointers?

If you're using gmake or a gnu-compatible make, you can do:

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

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



Reply to: