1 2# Development tree name for this version 3PRODUCT = @PRODUCT@ 4VERSION = @VERSION@ 5TREE = $(PRODUCT)-$(VERSION) 6 7# Utilities used in building the program 8SHELL = /bin/sh 9CC = @CC@ 10CTANGLE = ctangle 11CWEAVE = cweave 12DVIPS = dvips 13INSTALL = @INSTALL@ 14INSTALL_PROGRAM = @INSTALL_PROGRAM@ 15INSTALL_DATA = @INSTALL_DATA@ 16PDFTEX = pdftex 17TEX = tex 18XDVI = xdvi 19 20# Utility options 21CFLAGS = @CFLAGS@ 22LDFLAGS = @LDFLAGS@ 23 24# Targets 25PROGS = base64 26DOCUMENTS = base64.tex base64.pdf 27 28# Installation destinations 29 30## The 'DESTDIR' variable allows you to install the program into a different 31## location, e.g., for packaging, without affecting the compiled-in pathnames. 32DESTDIR = 33 34prefix = @prefix@ 35exec_prefix = @exec_prefix@ 36bindir = @bindir@ 37mandir = @mandir@ 38man1dir = $(mandir)/man1 39man1ext = .1 40BINDIR = $(DESTDIR)$(bindir) 41MAN1DIR = $(DESTDIR)$(man1dir) 42 43prog: $(PROGS) 44 45doc: $(DOCUMENTS) 46 47all: $(PROGS) $(DOCUMENTS) 48 49# Build executable program 50 51base64: base64.o getopt.o 52 $(CC) base64.o getopt.o -o base64 $(CFLAGS) $(LDFLAGS) 53 54# Create C source from web 55 56base64.c: base64.w 57 $(CTANGLE) base64.w 58 59# Build TeX documentation file from web 60 61base64.tex: base64.w 62 $(CWEAVE) base64.w 63 64# Create TeX .dvi file of documentation 65 66base64.dvi: base64.tex 67 $(TEX) base64.tex 68 69# View TeX documentation 70 71viewdoc: base64.dvi 72 $(XDVI) base64 73 74# Build PostScript file to print program 75 76base64.ps: base64.dvi 77 $(DVIPS) -f base64.dvi >base64.ps 78 79# Build PDF file of program and documentation 80base64.pdf: base64.tex 81 $(PDFTEX) base64.tex 82 83# Build auto-configuration scripts 84 85configurator: 86 rm -rf autom4te.cache 87 rm -f config.cache 88 autoconf 89 90# Installation 91 92install-bin: $(BINDIR) base64 93 $(INSTALL_PROGRAM) base64 $(BINDIR)/base64 94 95install-man: base64.1 96 $(INSTALL_DATA) base64.1 $(MAN1DIR)/base64$(man1ext) 97 98install: install-bin install-man 99 100# Uninstallation 101 102uninstall: 103 rm -f $(BINDIR)/base64 $(MAN1DIR)/base64$(man1ext) 104 105# There are a variety of levels of cleanliness 106# 107# clean: Remove object code, but leave C and TeX extracts from web 108# and generated documentation. The current build configuration 109# is preserved. 110clean: 111 rm -f $(PROGS) *.o *.bak *.shar *.zip *.tar.gz *.dvi core *.out \ 112 *.log 113# 114# distclean: Remove everything not present in the distribution. 115# This wipes out the build configuration; you must 116# re-run ./configure before rebuilding. 117distclean: clean 118 rm -rf autom4te.cache 119 rm -f config.cache config.h Makefile config.log config.status 120 rm -f base64.tex base64.idx base64.scn base64.toc 121# 122# maintainer-clean: Remove everything derivative from the 123# master web. We don't delete base64.c 124# because that causes configure to fail. 125maintainer-clean: distclean 126 @echo 'This command is intended for maintainers to use; it' 127 @echo 'deletes files that may need special tools to rebuild.' 128 rm -f *.ps *.pdf 129 130# Create distribution archives 131 132ARCH_SOURCE = Makefile.in base64.c base64.w config.h.in getopt.c getopt.h 133ARCH_DOC = base64.1 index.html b64.png rfc1341.html rfc1341.txt base64.pdf \ 134 COPYING INSTALL README log.txt 135ARCH_BIN = base64.exe 136ARCH_CONF = configure configure.in install-sh 137ARCH_WIN32 = base64.vcproj base64.sln testw32.bat 138 139ARCH_FILES = $(ARCH_SOURCE) $(ARCH_DOC) $(ARCH_BIN) $(ARCH_CONF) $(ARCH_WIN32) 140 141dist: 142 # Make zipped archive of Win32 executable 143 rm -f base64.zip 144 zip base64.zip $(ARCH_BIN) 145 # Make gzipped tar archive of complete distribution 146 rm -f $(TREE).tar.gz 147 rm -rf $(TREE) 148 mkdir $(TREE) 149 chmod 777 $(TREE) 150 @echo "Copying distribution files" 151 @for file in $(ARCH_FILES); do \ 152 cp -p $$file $(TREE); \ 153 done 154 tar cfv $(TREE).tar $(TREE) 155 gzip $(TREE).tar 156 rm -rf $(TREE) 157 158# Check for lint 159 160lint: base64.c 161 lint base64.c 162 163# View manual page 164 165manpage: 166 nroff -man base64.1 | $(PAGER) 167 168# Print manual page 169 170printman: 171 ptroff -man base64.1 172 173# Test it 174 175check: base64 176 ./base64 --encode <base64 >/tmp/base641.bak 177 ./base64 --decode </tmp/base641.bak >/tmp/base642.bak 178 -cmp -s base64 /tmp/base642.bak ; if test $$? -ne 0 ; then \ 179 echo '** base64: Redirection test failed. **' ; else \ 180 ./base64 -e base64 /tmp/base641.bak ;\ 181 ./base64 -d /tmp/base641.bak /tmp/base642.bak ;\ 182 cmp -s base64 /tmp/base642.bak ; if test $$? -ne 0 ; then \ 183 echo '** base64: Command line file argument test failed. **' ; else \ 184 echo 'All tests passed.' ; fi ; fi 185 @rm /tmp/base641.bak /tmp/base642.bak 186 187# Really test it 188 189wringer: base64 190 @echo 'This test performs 13 nested encodes and decodes starting' 191 @echo 'the application source and compares the result to the' 192 @echo 'original file.' 193 ./base64 -e base64.c /tmp/base641.bak # E 1 194 ./base64 -e /tmp/base641.bak /tmp/base642.bak # E 2 195 ./base64 -e /tmp/base642.bak /tmp/base643.bak # E 3 196 ./base64 -e /tmp/base643.bak /tmp/base644.bak # E 4 197 ./base64 -e /tmp/base644.bak /tmp/base645.bak # E 5 198 ./base64 -e /tmp/base645.bak /tmp/base646.bak # E 6 199 ./base64 -e /tmp/base646.bak /tmp/base647.bak # E 7 200 ./base64 -e /tmp/base647.bak /tmp/base648.bak # E 8 201 ./base64 -e /tmp/base648.bak /tmp/base649.bak # E 9 202 ./base64 -e /tmp/base649.bak /tmp/base64a.bak # E 10 203 ./base64 -e /tmp/base64a.bak /tmp/base64b.bak # E 11 204 ./base64 -e /tmp/base64b.bak /tmp/base64c.bak # E 12 205 ./base64 -e /tmp/base64c.bak /tmp/base64d.bak # E 13 206 # 207 ./base64 -d /tmp/base64d.bak /tmp/dase64c.bak # D 1 208 ./base64 -d /tmp/dase64c.bak /tmp/dase64b.bak # D 2 209 ./base64 -d /tmp/dase64b.bak /tmp/dase64a.bak # D 3 210 ./base64 -d /tmp/dase64a.bak /tmp/dase649.bak # D 4 211 ./base64 -d /tmp/dase649.bak /tmp/dase648.bak # D 5 212 ./base64 -d /tmp/dase648.bak /tmp/dase647.bak # D 6 213 ./base64 -d /tmp/dase647.bak /tmp/dase646.bak # D 7 214 ./base64 -d /tmp/dase646.bak /tmp/dase645.bak # D 8 215 ./base64 -d /tmp/dase645.bak /tmp/dase644.bak # D 9 216 ./base64 -d /tmp/dase644.bak /tmp/dase643.bak # D 10 217 ./base64 -d /tmp/dase643.bak /tmp/dase642.bak # D 11 218 ./base64 -d /tmp/dase642.bak /tmp/dase641.bak # D 13 219 ./base64 -d /tmp/dase641.bak /tmp/dase640.bak # D 13 220 # 221 -cmp -s /tmp/dase640.bak base64.c ; if test $$? -ne 0 ; then \ 222 echo '** base64 Wringer test failed. **' ; else \ 223 echo 'Wringer test passed.' ; fi 224 @rm /tmp/base64?.bak /tmp/dase64?.bak 225 226.SUFFIXES: 227.SUFFIXES: .c .o .ch .dvi .tex .w .1 228