Using BSD make, how can I apply different rules based on different
directories while using only a single makefile?


Ie, the appended Makefile results in the following compilations:

    gcc -DLIB -c lib/foo.c -o lib/foo.o
    gcc -DLIB -c lib/bar.c -o lib/bar.o
    gcc -DMCP -c mcp/baz.c -o mcp/baz.o

Is it possible to do something similar with BSD make?

Drew


###################################
.SUFFIXES:
.SUFFIXES: .o .c

LIB=\
        lib/foo.c \
        lib/bar.c

MCP=\
        mcp/baz.c

all: $(LIB:.c=.o) $(MCP:.c=.o)

lib/%.o: lib/%.c
        gcc -DLIB -c $< -o $@

mcp/%.o: mcp/%.c
        gcc -DMCP -c $< -o $@

.PHONY: clean
clean:
        rm -f $(LIB:.c=.o) $(MCP:.c=.o)
###################################
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to