From owner-freebsd-hackers Tue Feb 16 7:23:24 1999 Received: (from root@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA29638 for freebsd-hackers; Tue, 16 Feb 1999 07:23:21 -0800 (PST) (envelope-from peter) Received: from csmd2.cs.uni-magdeburg.de (prinz-atm.CS.Uni-Magdeburg.De [141.44.30.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA25382 for ; Tue, 16 Feb 1999 06:41:54 -0800 (PST) (envelope-from jesse@prinz-atm.CS.Uni-Magdeburg.De) Received: from knecht.cs.uni-magdeburg.de (knecht [141.44.21.3]) by csmd2.cs.uni-magdeburg.de (8.9.1a/8.9.1) with ESMTP id PAA28193 for ; Tue, 16 Feb 1999 15:41:45 +0100 (MET) Received: (from jesse@localhost) by knecht.cs.uni-magdeburg.de (8.8.8+Sun/8.8.8) id PAA01708 for freebsd-hackers@freebsd.org; Tue, 16 Feb 1999 15:41:45 +0100 (MET) Message-ID: <19990216154145.A1700@cs.uni-magdeburg.de> Date: Tue, 16 Feb 1999 15:41:45 +0100 From: Roland Jesse To: freebsd-hackers@freebsd.org Subject: Makefile: >1 program without a single target each. Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, Assumed, I have the source code for more than just one program in a directory (because they share a couple source code files). How does the Makefile has to / should look like? Normally, I would do something like: PROG= myprog SRCS= myprog.c utils.c otherstuff.c NOMAN= No manual page yet. BINDIR= /usr/local/bin .include This is passed to: OBJS+= ${SRCS:N*.h:R:S/$/.o/g} ${PROG}: ${OBJS} ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} But what do I do when the Makefile is supposed to handle more than just one potential target? How do I specify the OBJS variable depending on the different source files? Scenario: PROG1= myprog PROG2= herprog SRCS1= myprog.c utils.c otherstuff.c SRCS2= herprog.c herprog.h utils.c otherstuff.c NOMAN= No manual page yet. BINDIR= /usr/local/bin .include I do not want to specify the whole compilation line for each program like in: MYOBJS= myprog.o utils.o otherstuff.o myprog: $(MYOBJS) ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} $(MYOBJS) ${LDDESTDIR} ${LDADD}HEROBJS= herprog.o utils.o otherstuff.o herprog: $(HEROBJS) ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} $(HEROBJS) ${LDDESTDIR} ${LDADD} Any ideas to get around the OBJS-problem are appreciated. Roland To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message