From owner-freebsd-questions@FreeBSD.ORG Fri Mar 18 03:11:40 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9CD116A4CE for ; Fri, 18 Mar 2005 03:11:40 +0000 (GMT) Received: from xenial.mcc.ac.uk (xenial.mcc.ac.uk [130.88.203.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E282843D39 for ; Fri, 18 Mar 2005 03:11:39 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97]) by xenial.mcc.ac.uk with esmtp (Exim 4.43 (FreeBSD)) id 1DC7ti-000P4h-O7 for freebsd-questions@freebsd.org; Fri, 18 Mar 2005 03:11:38 +0000 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) j2I3BcnH099899 for ; Fri, 18 Mar 2005 03:11:38 GMT (envelope-from jcm@dogma.freebsd-uk.eu.org) Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.13.1/8.12.6/Submit) id j2I3BcjJ099898 for freebsd-questions@freebsd.org; Fri, 18 Mar 2005 03:11:38 GMT Date: Fri, 18 Mar 2005 03:11:37 +0000 From: Jonathon McKitrick To: freebsd-questions@freebsd.org Message-ID: <20050318031137.GA99419@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Subject: How to include header files in makefiles X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 03:11:40 -0000 Hi all, I'm setting up a build system for a small project and I want to use included makefiles. I have a base.mk that looks like this: .PATH.h : ../ ../include .INCLUDES : .h CFLAGS = -O -pipe -Wall -g CFLAGS += $(.INCLUDES) OBJS = ${SRCS:R:S/$/.o/g} and a bin.mk that looks like this: include ../include/mk/base.mk all: ${BIN} ${BIN}: ${OBJS} ${CC} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} so that a makefile for a specific program looks like this: BIN = app SRCS = app.c LDFLAGS += -pthread include ../include/mk/bin.mk But I'm having a problem figuring out how to handle header files. I have some that are local to this binary, but others are in the project include directory. How can I include the .h files so the .c files are recompiled when the header files they require are changed? GNU make has 'make depend' but I'd like a better, BSDmake-centric way, if possible. Thanks for your help, jm --