Subject: CFLAGS in own software makefiles and pkgsrc
To: None <tech-pkg@netbsd.org>
From: Florian Stoehr <netbsd@wolfnode.de>
List: tech-pkg
Date: 02/25/2005 15:47:43
Hi,

I use to create Makefiles of the following style for my own projects:

----------------
CC=cc
CFLAGS=-O2
LDFLAGS=
LIBS=-lutil

all: myprj

myprj: myprj.o
 	$(CC) $(CFLAGS) -o myprj $(LIBS) myprj.o

myprj.o: myprj.c
 	$(CC) $(CFLAGS) -c myprj.c

clean:
 	@rm *.o || true
 	@rm myprj || true
--------------

Is this OK for pkgsrc? I think the CFLAGS will cause trouble since this
will not allow custom CFLAGS+= in /etc/mk.conf. What to change here?

As I don't have an install target here, I'll use like

do-install:
         ${INSTALL_PROGRAM} ${WRKSRC}/myprj ${PREFIX}/bin
         ${INSTALL_MAN} ${WRKSRC}/myprj.1 ${PREFIX}/man/man1

to the pkgsrc Makefile. Also OK?

With this configuration, "make install", "make deinstall", "make package" 
all work perfectly. Anything to improve here?

Thanks
Florian