Date: Thu, 7 Aug 2003 14:42:30 -0400 (EDT) From: Andrew Gallatin <gallatin@cs.duke.edu> To: freebsd-hackers@freebsd.org Subject: BSD make question Message-ID: <16178.40342.11000.35373@grasshopper.cs.duke.edu>
next in thread | raw e-mail | index | archive | help
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)
###################################
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16178.40342.11000.35373>
