Subject: Makefile rules
To: None <tech-userlevel@netbsd.org>
From: Stuart Brooks <stuartb@cat.co.za>
List: tech-userlevel
Date: 09/09/2004 13:12:57
Hi there,

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) ...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The only way I can see to do it with the Netbsd make is to manually specify
the dependencies (as follows) which I don't want to do as it means
maintaining a dual list of objects which is a pain once you get past 50 or
so...

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DIR = some_directory
OBJECTS = $(DIR)/main.o $(DIR)/t1.o ... $(DIR)/t50.o

.SUFFIXES: .cpp
.cpp.o:
  $(COMPILER) -o ...

TARGET: $(OBJECTS)
  $(LINKER) ...

$(DIR)/main.o: main.cpp
$(DIR)/t1.o: t1.cpp
...
$(DIR)/t50.o: t50.cpp
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any ideas how to get round this?

Regards
 Stuart