# Everything we have to do in order to mirror the Unix Archive, and cut a
# CD-ROM image from the files in the local archive.
#
# You MUST set up the .depend file for this makefile to work correctly.
# See .depend for variables you can set which control the make commands.
RSYNC=/usr/local/bin/rsync -avuz --delete $(N) $(PASSWDFILE) $(NOISO)

all:
	@echo 'No, choose one of the sub-options: image1, image2, images, sync'

# Connect to a remote rsync server which has a copy of the Unix Archive
# and mirror it here
sync: .depend
	$(RSYNC) $(RSERVER)::UA_Root \
		--exclude Applications \
		--exclude 4BSD \
		--exclude PDP-11 \
		--exclude VAX \
		--exclude Other \
		--exclude Mirroring		     $(PD)
	$(RSYNC) $(RSERVER)::UA_Applications $(PD)/Applications
	$(RSYNC) $(RSERVER)::UA_4BSD         $(PD)/4BSD
	$(RSYNC) $(RSERVER)::UA_PDP11        $(PD)/PDP-11
	$(RSYNC) $(RSERVER)::UA_VAX          $(PD)/VAX
	$(RSYNC) $(RSERVER)::UA_Other        $(PD)/Other
	$(RSYNC) $(RSERVER)::UA_Mirroring \
	--exclude .depend --exclude .rsync_passwd \
 						    $(PD)/Mirroring


# Build a Rock Ridge image of Vol.1 of the archive, the PDP-11 disk. You may
# want to change the producer's identification (PREP) in .depend.
#
image1: Makefile .depend
	echo 'APPI=Unix Archive Volume 1: PDP-11 category' > .mkisofsrc
	echo 'COPY=The Unix Heritage Society' >> .mkisofsrc
	echo 'ABST=The Unix Archive, Volume 1: PDP-11 category' >> .mkisofsrc
	echo "PREP=$(PREP)" >> .mkisofsrc
	echo 'PUBL=The Unix Heritage Society   http://tuhs.org/TUHS/' \
								>> .mkisofsrc
	perl $(PD)/Mirroring/snap_date >> .mkisofsrc
	echo 'SYSI=UNIX' >> .mkisofsrc
	echo 'VOLI=Unix Archive Volume 1: PDP-11 category' >> .mkisofsrc
	nice mkisofs -v -o $(IMG1) -r -D $(PS) \
		-x $(PD)/.htaccess -x $(PD)/.message -x $(PD)/Mirroring \
		-x $(PD)/bin -x $(PD)/TODO -x $(PD)/etc -x $(PD)/incoming \
		-x $(PD)/VAX \
		-x $(PD)/Other \
		-x $(PD)/4BSD \
		$(PD)

# Build a Rock Ridge image of Vol.2 of the archive, the VAX & 4BSD disk. You may
# want to change the producer's identification (PREP) in .depend.
#
image2: Makefile .depend
	echo 'APPI=Unix Archive Volume 2: VAX & 4BSD category' > .mkisofsrc
	echo 'COPY=The Unix Heritage Society' >> .mkisofsrc
	echo 'ABST=The Unix Archive, Volume 2: VAX & 4BSD category' \
								>> .mkisofsrc
	echo "PREP=$(PREP)" >> .mkisofsrc
	echo 'PUBL=The Unix Heritage Society   http://tuhs.org/TUHS/' \
								>> .mkisofsrc
	perl $(PD)/Mirroring/snap_date >> .mkisofsrc
	echo 'SYSI=UNIX' >> .mkisofsrc
	echo 'VOLI=Unix Archive Volume 2: VAX & 4BSD category' >> .mkisofsrc
	nice mkisofs -v -o $(IMG2) -r -D $(PS) \
		-x $(PD)/.htaccess -x $(PD)/.message -x $(PD)/Mirroring \
		-x $(PD)/bin -x $(PD)/TODO -x $(PD)/etc -x $(PD)/incoming \
		-x $(PD)/PDP-11 \
		$(PD)

# Some dummy make targets just in case we type make image or make images
image: image1

images: image1 image2
