From: metcalf@hing.lcs.mit.edu (Chris Metcalf)
Subject: finger-1.35: Makefile problems for --srcdir builds
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 6 Sep 1992 09:03:02 GMT

I built Gnu finger 1.35 using the --srcdir option to specify a
different directory for the sources.  This did about half the right
things, given my version of make (not a Gnu make but a SunOS-ish make 
in use at MIT LCS that understand VPATH and other interesting things).
The changes below convert, for sources, relative path references into
references prefixed with $(srcdir).  targets/Makefile.in requires a
definition of $srcdir for this to work.

I also replaced uses of Gnu make -C with explicit "cd foo; make" to
be more portable.

Though not mentioned in the patches, I believe the right thing to do
in lib/x_show_face.c is to use "#ifndef X11R3" instead of "#ifdef
X11R4", since X11R5 treats the Xaw stuff just like X11R4.

Chris Metcalf
MIT Lab for Computer Science


*** 1.1	1992/09/06 02:24:11
--- src/Makefile.in	1992/09/06 12:18:35
***************
*** 4,12 ****
  
  BINDIR = /usr/local/bin
  ETCDIR = /usr/local/etc
! INCFLAGS = -I.. -I../include
! INCLUDES = ../include
! SUPPORT = ../support
  
  FINGERLIB = ../lib
  
--- 4,12 ----
  
  BINDIR = /usr/local/bin
  ETCDIR = /usr/local/etc
! INCFLAGS = -I$(srcdir)/.. -I$(srcdir)/../include
! INCLUDES = $(srcdir)/../include
! SUPPORT = $(srcdir)/../support
  
  FINGERLIB = ../lib
  
***************
*** 55,78 ****
  		$(LINKCMD) $(CFLAGS) -o in.fingerd in.fingerd.o $(LIBR)
  
  $(FINGERLIB):
! 		$(MAKE) -C $(FINGERLIB)
  
  .fingerdir: $(INCLUDES)/fingerpaths.h
  	$(SUPPORT)/prdefine FINGERDIR $(INCLUDES)/fingerpaths.h >.fingerdir
  
! .etcdir:  ../config.h
! 	$(SUPPORT)/prdefine EtcDir ../config.h >.etcdir
  
! .bindir:  ../config.h
! 	$(SUPPORT)/prdefine BinDir ../config.h >.bindir
  
! fingerd.o: fingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h $(INCLUDES)/tcp.h ../config.h
! fingerd.o: $(INCLUDES)/error.h $(INCLUDES)/fingerpaths.h ../config.h
! finger.o: finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/packet.h ../config.h
! finger.o: $(INCLUDES)/tcp.h $(INCLUDES)/error.h ../config.h
  
! in.fingerd.o: in.fingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h ../config.h
! in.cfingerd.o: in.cfingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h ../config.h
  
  server:	install
  
--- 55,78 ----
  		$(LINKCMD) $(CFLAGS) -o in.fingerd in.fingerd.o $(LIBR)
  
  $(FINGERLIB):
! 		cd $(FINGERLIB); $(MAKE) $(FINGERLIB)
  
  .fingerdir: $(INCLUDES)/fingerpaths.h
  	$(SUPPORT)/prdefine FINGERDIR $(INCLUDES)/fingerpaths.h >.fingerdir
  
! .etcdir:  $(srcdir)/../config.h
! 	$(SUPPORT)/prdefine EtcDir $(srcdir)/../config.h >.etcdir
  
! .bindir:  $(srcdir)/../config.h
! 	$(SUPPORT)/prdefine BinDir $(srcdir)/../config.h >.bindir
  
! fingerd.o: fingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h $(INCLUDES)/tcp.h $(srcdir)/../config.h
! fingerd.o: $(INCLUDES)/error.h $(INCLUDES)/fingerpaths.h $(srcdir)/../config.h
! finger.o: finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/packet.h $(srcdir)/../config.h
! finger.o: $(INCLUDES)/tcp.h $(INCLUDES)/error.h $(srcdir)/../config.h
  
! in.fingerd.o: in.fingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h $(srcdir)/../config.h
! in.cfingerd.o: in.cfingerd.c $(INCLUDES)/client.h $(INCLUDES)/packet.h $(srcdir)/../config.h
  
  server:	install
  
*** 1.1	1992/09/06 02:25:20
--- lib/Makefile.in	1992/09/06 02:25:44
***************
*** 4,11 ****
  #
  srcdir = @srcdir@
  VPATH = $(srcdir)
! INCLUDES = ../include
! INCFLAGS = -I$(INCLUDES) -I..
  RM = rm -f
  AR = ar
  
--- 4,11 ----
  #
  srcdir = @srcdir@
  VPATH = $(srcdir)
! INCLUDES = $(srcdir)/../include
! INCFLAGS = -I$(INCLUDES) -I$(srcdir)/..
  RM = rm -f
  AR = ar
  
***************
*** 64,70 ****
  $(SITE_OBJECTS): $(SITE_SOURCES)
  	(cd site; $(MAKE) all)
  
! $(SITE_SOURCES): ../config.h $(INCLUDES)/fingerpaths.h
  
  clean:
  	rm -f TAGS Makefile *.o *.a $(OTHER_FILES)
--- 64,70 ----
  $(SITE_OBJECTS): $(SITE_SOURCES)
  	(cd site; $(MAKE) all)
  
! $(SITE_SOURCES): $(srcdir)/../config.h $(INCLUDES)/fingerpaths.h
  
  clean:
  	rm -f TAGS Makefile *.o *.a $(OTHER_FILES)
***************
*** 77,83 ****
  tcp.o: tcp.c  $(INCLUDES)/tcp.h
  tty.o: $(INCLUDES)/fingerpaths.h
  util.o: $(INCLUDES)/fingerpaths.h util.c
! bitmap.o: bitmap.c $(INCLUDES)/bitmap.h ../config.h
  read_bitmap.o: read_bitmap.c $(INCLUDES)/bitmap.h
  read_rastfile.o: read_rastfile.c $(INCLUDES)/bitmap.h
  read_x_bitmap.o: read_x_bitmap.c $(INCLUDES)/bitmap.h
--- 77,83 ----
  tcp.o: tcp.c  $(INCLUDES)/tcp.h
  tty.o: $(INCLUDES)/fingerpaths.h
  util.o: $(INCLUDES)/fingerpaths.h util.c
! bitmap.o: bitmap.c $(INCLUDES)/bitmap.h $(srcdir)/../config.h
  read_bitmap.o: read_bitmap.c $(INCLUDES)/bitmap.h
  read_rastfile.o: read_rastfile.c $(INCLUDES)/bitmap.h
  read_x_bitmap.o: read_x_bitmap.c $(INCLUDES)/bitmap.h
***************
*** 87,93 ****
  save_rastfile.o: save_rastfile.c $(INCLUDES)/bitmap.h
  save_x_bitmap.o: save_x_bitmap.c $(INCLUDES)/bitmap.h
  save_lispmug.o: save_lispmug.c $(INCLUDES)/bitmap.h
! x_show_face.o: x_show_face.c $(INCLUDES)/bitmap.h ../config.h
  sun_show_face.o: sun_show_face.c $(INCLUDES)/bitmap.h
  face-finger.o: face-finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/bitmap.h
  text-finger.o: text-finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/packet.h
--- 87,93 ----
  save_rastfile.o: save_rastfile.c $(INCLUDES)/bitmap.h
  save_x_bitmap.o: save_x_bitmap.c $(INCLUDES)/bitmap.h
  save_lispmug.o: save_lispmug.c $(INCLUDES)/bitmap.h
! x_show_face.o: x_show_face.c $(INCLUDES)/bitmap.h $(srcdir)/../config.h
  sun_show_face.o: sun_show_face.c $(INCLUDES)/bitmap.h
  face-finger.o: face-finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/bitmap.h
  text-finger.o: text-finger.c $(INCLUDES)/fingerpaths.h $(INCLUDES)/packet.h
*** 1.1	1992/09/06 02:25:54
--- lib/site/Makefile.in	1992/09/06 02:26:48
***************
*** 26,32 ****
  # The object files for making site.o.
  OBJECTS = $(Objects)
  
! INCFLAGS = -I../../include -I../..
  
  all: site.o $(ExtraProgs)
  
--- 26,32 ----
  # The object files for making site.o.
  OBJECTS = $(Objects)
  
! INCFLAGS = -I$(srcdir)/../../include -I$(srcdir)/../..
  
  all: site.o $(ExtraProgs)
  
***************
*** 48,55 ****
  mkpasswd: mkpasswd.o recedit.o ../util.o
  	$(CC) $(CFLAGS) $(DEFS) $(INCFLAGS) -o mkpasswd mkpasswd.o recedit.o ../util.o $(LIBS) $(LIBOBJS) -ldbm
  
! ../util.o: ../util.c
! 	$(MAKE) -C .. util.o
  
  install:
  
--- 48,55 ----
  mkpasswd: mkpasswd.o recedit.o ../util.o
  	$(CC) $(CFLAGS) $(DEFS) $(INCFLAGS) -o mkpasswd mkpasswd.o recedit.o ../util.o $(LIBS) $(LIBOBJS) -ldbm
  
! ../util.o: $(srcdir)/../util.c
! 	cd ..; $(MAKE) util.o
  
  install:
  
***************
*** 56,64 ****
  clean:
  	rm -f TAGS *.o *.a Makefile $(ExtraProgs)
  
! userinfo.o: userinfo.c ../../config.h
! userface.o: userface.c ../../config.h
! dbminfo.o: dbminfo.c ../../include/fingerpaths.h
  makeusers.o: makeusers.c recedit.h
  recedit.o: recedit.c
  edituser.o: edituser.c recedit.h
--- 56,64 ----
  clean:
  	rm -f TAGS *.o *.a Makefile $(ExtraProgs)
  
! userinfo.o: userinfo.c $(srcdir)/../../config.h
! userface.o: userface.c $(srcdir)/../../config.h
! dbminfo.o: dbminfo.c $(srcdir)/../../include/fingerpaths.h
  makeusers.o: makeusers.c recedit.h
  recedit.o: recedit.c
  edituser.o: edituser.c recedit.h
*** 1.1	1992/09/06 16:11:17
--- targets/Makefile.in	1992/09/06 16:12:32
***************
*** 1,6 ****
  # Install default targets.
  
! INCLUDE = ../include
  
  all:
  	
--- 1,7 ----
  # Install default targets.
  
! srcdir = @srcdir@
! INCLUDE = $(srcdir)/../include
  
  all:
  	
***************
*** 9,15 ****
  
  install: .targetdir
  	-if [ ! -r `cat .targetdir` ] ; then mkdir `cat .targetdir`; fi
! 	cp [slx]-* `cat .targetdir`
  	chmod 755 `cat .targetdir`/*
  
  server:	install
--- 10,16 ----
  
  install: .targetdir
  	-if [ ! -r `cat .targetdir` ] ; then mkdir `cat .targetdir`; fi
! 	cp $(srcdir)/[slx]-* `cat .targetdir`
  	chmod 755 `cat .targetdir`/*
  
  server:	install

Newsgroups: gnu.utils.bug