🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #1986

split source and object directories

#1986
From: Anthony Shipman
Date: Wed, 06 Jan 1993 07:18
40 lines
1866 bytes
When a site has heterogeneous workstations and one central NFS server 
holding source it would be very useful if the makefiles supported separate
source and object directories.

Eg the makefile can define

#	Default source location
SRC	=	.

Then every reference to a source file in the makefile is qualified with the
source directory.  References to object file could be assumed to be in the
current directory as at present or they could be qualified with an object
directory too.

eg

$(OBJ)/prog: $(SRC)/prog.c $(SRC)/prog.h
	$(CC) $(CFLAGS) -o $(OBJ)/prog $(SRC)/prog.c

or assuming . is always the working directory

prog: $(SRC)/prog.c $(SRC)/prog.h
	$(CC) $(CFLAGS) -o prog $(SRC)/prog.c

Then on each workstation when I build the program I just supply the source
directory on the command line (along with other machine dependent flags).

eg
	cd obj/prog-1.1
	src=/server/comp/sources/misc/prog-1.1 
	make -f $src/Makefile SRC=$src ...  install

Would anybody else find this arrangement useful?  I would like to see it as a
standard for makefiles in comp.sources.

--
Anthony Shipman                 "You've got to be taught before it's too late,
CP Software Export Pty Ltd,      Before you are six or seven or eight,
19 Cato St., East Hawthorn,      To hate all the people your relatives hate,
Melbourne, Australia, 3121       You've got to be carefully taught."  R&H
Technical Details
Message-ID: <als.726304707@marloo.kowari.cpsg.com.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!kowari.cpsg.com.au!als

Show Full Headers
Complete Article Headers
Newsgroups: comp.sources.d
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!kowari.cpsg.com.au!als
From: als@bohra.cpg.oz.au (Anthony Shipman)
Subject: split source and object directories
Message-ID: <als.726304707@marloo.kowari.cpsg.com.au>
Sender: news@kowari.cpsg.com.au (USENET News System)
Nntp-Posting-Host: marloo.cpsg.com.au
Organization: Computer Power Software Group Pty Ltd
Date: Wed, 6 Jan 1993 07:18:27 GMT
Lines: 40