home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sources / d / 1515 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.8 KB  |  52 lines

  1. Newsgroups: comp.sources.d
  2. Path: sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!kowari.cpsg.com.au!als
  3. From: als@bohra.cpg.oz.au (Anthony Shipman)
  4. Subject: split source and object directories
  5. Message-ID: <als.726304707@marloo.kowari.cpsg.com.au>
  6. Sender: news@kowari.cpsg.com.au (USENET News System)
  7. Nntp-Posting-Host: marloo.cpsg.com.au
  8. Organization: Computer Power Software Group Pty Ltd
  9. Date: Wed, 6 Jan 1993 07:18:27 GMT
  10. Lines: 40
  11.  
  12. When a site has heterogeneous workstations and one central NFS server 
  13. holding source it would be very useful if the makefiles supported separate
  14. source and object directories.
  15.  
  16. Eg the makefile can define
  17.  
  18. #    Default source location
  19. SRC    =    .
  20.  
  21. Then every reference to a source file in the makefile is qualified with the
  22. source directory.  References to object file could be assumed to be in the
  23. current directory as at present or they could be qualified with an object
  24. directory too.
  25.  
  26. eg
  27.  
  28. $(OBJ)/prog: $(SRC)/prog.c $(SRC)/prog.h
  29.     $(CC) $(CFLAGS) -o $(OBJ)/prog $(SRC)/prog.c
  30.  
  31. or assuming . is always the working directory
  32.  
  33. prog: $(SRC)/prog.c $(SRC)/prog.h
  34.     $(CC) $(CFLAGS) -o prog $(SRC)/prog.c
  35.  
  36. Then on each workstation when I build the program I just supply the source
  37. directory on the command line (along with other machine dependent flags).
  38.  
  39. eg
  40.     cd obj/prog-1.1
  41.     src=/server/comp/sources/misc/prog-1.1 
  42.     make -f $src/Makefile SRC=$src ...  install
  43.  
  44. Would anybody else find this arrangement useful?  I would like to see it as a
  45. standard for makefiles in comp.sources.
  46.  
  47. --
  48. Anthony Shipman                 "You've got to be taught before it's too late,
  49. CP Software Export Pty Ltd,      Before you are six or seven or eight,
  50. 19 Cato St., East Hawthorn,      To hate all the people your relatives hate,
  51. Melbourne, Australia, 3121       You've got to be carefully taught."  R&H
  52.