New directory structure?

Roy Fielding (fielding@beach.w3.org)
Tue, 18 Jul 1995 15:42:24 -0400


One of the things I've been toying with is a new distribution
directory structure, with a new Makefile.  Here is what it looks
like on my system (after the make):

====================================================================
fielding@beach% d -R
total 36
drwxr-xr-x   5 fielding users        1024 Jun 30 16:22 ./
drwxr-xr-x   5 fielding users        1024 Jul  2 16:32 ../
-rw-r--r--   1 fielding users        4919 Aug  1  1994 Artistic.txt
-rw-r--r--   1 fielding users       11799 Sep 20  1994 INSTALL.txt
-rw-r--r--   1 fielding users       12571 Jun 30 16:16 README.html
drwxrwxr-x   2 fielding users        1024 Jun 30 19:13 bin/
drwxrwxr-x   2 fielding users        1024 Jun 30 16:14 lib/
drwxrwxr-x   2 fielding users        1024 Jun 30 19:04 src/
 
bin:
total 20
drwxrwxr-x   2 fielding users        1024 Jun 30 19:13 ./
drwxr-xr-x   5 fielding users        1024 Jun 30 16:22 ../
-rwxr-xr-x   1 fielding users        7775 Jun 30 19:13 GET*
lrwxrwxrwx   1 fielding users           3 Jun 30 19:13 HEAD -> GET*
lrwxrwxrwx   1 fielding users           3 Jun 30 19:13 POST -> GET*
-rwxr-xr-x   1 fielding users        2428 Jun 30 19:13 testbot*
-rwxr-xr-x   1 fielding users         879 Jun 30 19:13 testdates*
-rwxr-xr-x   1 fielding users         769 Jun 30 19:13 testescapes*
-rwxr-xr-x   1 fielding users        4414 Jun 30 19:13 testlinks*
 
lib:
total 106
drwxrwxr-x   2 fielding users        1024 Jun 30 16:14 ./
drwxr-xr-x   5 fielding users        1024 Jun 30 16:22 ../
-rw-r--r--   1 fielding users        8324 Sep 20  1994 LWP_Changes.pl
-rw-r--r--   1 fielding users        1807 Sep 20  1994 hostname.pl
-rw-r--r--   1 fielding users        2631 Sep  1  1994 mime.types
-rw-r--r--   1 fielding users       14204 Sep 20  1994 www.pl
-rw-r--r--   1 fielding users       16183 Sep 20  1994 wwwbot.pl
-rw-r--r--   1 fielding users        7914 Sep 20  1994 wwwdates.pl
-rw-r--r--   1 fielding users        3766 Jul  8  1994 wwwerror.pl
-rw-r--r--   1 fielding users        6002 Jul  8  1994 wwwfile.pl
-rw-r--r--   1 fielding users        6390 Jul 22  1994 wwwhtml.pl
-rw-r--r--   1 fielding users        7567 Sep 20  1994 wwwhttp.pl
-rw-r--r--   1 fielding users        9163 Aug  1  1994 wwwmailcap.pl
-rw-r--r--   1 fielding users        3725 Jul 15  1994 wwwmime.pl
-rw-r--r--   1 fielding users       11997 Sep 20  1994 wwwurl.pl
 
src:
total 23
drwxrwxr-x   2 fielding users        1024 Jun 30 19:04 ./
drwxr-xr-x   5 fielding users        1024 Jun 30 16:22 ../
-rw-r--r--   1 fielding users        7776 Jun 30 19:06 GET.pl
-rw-r--r--   1 fielding users        1770 Jun 30 19:30 Makefile
-rw-r--r--   1 fielding users         541 Sep 20  1994 sys_socket_ph.c
-rw-r--r--   1 fielding users        2429 Aug  1  1994 testbot.pl
-rw-r--r--   1 fielding users         880 Jul  8  1994 testdates.pl
-rw-r--r--   1 fielding users         770 Jul  8  1994 testescapes.pl
-rw-r--r--   1 fielding users        4415 Sep 20  1994 testlinks.pl
====================================================================

There are a couple advantages, but mostly it allows a cleaner
separation between the applications, documentation, and library.
It also means that the install can be more automated:

====================================================================
# $Id: Makefile $
#
# This Makefile is used to configure the perl scripts so that
# they all use the correct pathname for the perl interpreter.
# It also makes the programs executable and creates links from "GET"
# to the other commonly-used methods.  Use the following command:
#
#     % make all
#
# You need to change the following line to the full pathname
# of your perl interpreter

PERLBIN = /usr/local/bin/perl

# and LWP should be the full pathname of the directory above this one

LWP     = /home/fielding/public/lwp

# and here are a couple commands that may be system-dependent

CC      = gcc
LINK    = ln -s

# The rest should be automatic

OLDPERL = /usr/public/bin/perl
LWPBIN  = $(LWP)/bin
LWPLIB  = $(LWP)/lib

CLIENTS = GET testbot testdates testescapes testlinks HEAD POST

.SUFFIXES:
.SUFFIXES: .pl $(SUFFIXES)

all: $(CLIENTS) reminder

GET: GET.pl
testbot: testbot.pl
testdates: testdates.pl
testescapes: testescapes.pl
testlinks: testlinks.pl

.pl:
	cp $*.pl $(LWPBIN)/$*
	cd $(LWPBIN) ;\
	$(PERLBIN) -pi -e 's#$(OLDPERL)#$(PERLBIN)#o' $* ;\
	chmod 755 $*

HEAD: GET
	cd $(LWPBIN) ;\
	$(LINK) GET HEAD

POST: GET
	cd $(LWPBIN) ;\
	$(LINK) GET POST

reminder:
	@ echo ""
	@ echo "Remember to set the library environment variable, as in"
	@ echo ""
	@ echo "    setenv LIBWWW_PERL $(LWPLIB)"
	@ echo ""
	@ echo "It should probably be put in your shell startup file."
	@ echo ""

#
# A "make clean" removes what "make all" produced
#

clean:
	cd $(LWPBIN) ;\
	$(RM) $(CLIENTS)

#
# Now this part is only used if you are having problems with sockets
# on non-BSD systems.  It just compiles the test program.
#

socket:
	$(CC) -o sys_socket_ph sys_socket_ph.c

socket-clean:
	$(RM) sys_socket_ph.o sys_socket_ph

====================================================================
It would be nice if the Perl5 version used an analogous structure.
Note that I renamed "get" to GET because of collisions with SCCS.

......Roy