Subject: Re: Makefile rules
To: Stuart Brooks <stuartb@cat.co.za>
From: Jachym Holecek <freza@psi.cz>
List: tech-userlevel
Date: 09/09/2004 14:40:08
Hello,
> I was wondering what version of make Netbsd uses. In particular the one I
> have on my Netbsd 1.5.1 system only appears to support .SUFFIX rules, as
> opposed to gmake which allows pattern matching in its implicit rules.
>
> FWIW I am trying to get make to build to a different directory depending on
> the defines, something like:
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> DIR = some_directory
> OBJECTS = $(DIR)/main.o $(DIR)/t1.o ... $(DIR)/t50.o
>
> $(DIR)/%.o : %.cpp
> $(COMPILER) -c ...
>
> TARGET: $(OBJECTS)
> $(LINKER) ...
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Maybe something like this?
DIR = some_directory
OBJECTS = main.o t1.o ... t50.o
# For BSD make
.PATH: ${DIR}
# For GNU make
VPATH=". ${DIR}"
%.o : %.cpp
$(COMPILER) -c ...
TARGET: $(OBJECTS)
$(LINKER) ...
And if you don't mind being BSD specific, you could safe yourself some work
(such as standard compile + links rules) using bsd.*.mk framework.
Regards,
-- Jachym Holecek