| 1 |
|
| 2 |
PROGS = codegroup |
| •3 |
# CFLAGS = -O -Wall |
| 4 |
PAGER = more |
| •5 |
BIN = $(DESTDIR)/usr/bin |
| 6 |
|
| 7 |
all: $(PROGS) |
| 8 |
|
| 9 |
clean: |
| 10 |
rm -f $(PROGS) *.o *.bak *.zip core code.* *.out |
| 11 |
|
| 12 |
codegroup: codegroup.o |
| •13 |
$(CC) codegroup.o -o codegroup $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) |
| 14 |
|
| •15 |
install: ${ALL} |
| 16 |
install codegroup ${BIN} |
| 17 |
|
| 18 |
# Create zipped archive |
| 19 |
|
| 20 |
RELFILES = Makefile codegroup.1 codegroup.c \ |
| 21 |
codegroup.html codegroup.jpg codegroup.man codegrp.exe |
| 22 |
|
| 23 |
release: |
| 24 |
rm -f codegroup.zip |
| 25 |
zip codegroup.zip $(RELFILES) |
| 26 |
|
| 27 |
# Test by encoding and decoding the program binary |
| 28 |
|
| 29 |
check: codegroup |
| 30 |
./codegroup -e <codegroup >codegroup1.bak |
| 31 |
./codegroup -d <codegroup1.bak >codegroup2.bak |
| 32 |
-cmp -s codegroup codegroup2.bak ; if test $$? -ne 0 ; then \ |
| 33 |
echo '** codegroup: Redirection test failed. **' ; else \ |
| 34 |
./codegroup -e codegroup codegroup1.bak ;\ |
| 35 |
./codegroup -d codegroup1.bak codegroup2.bak ;\ |
| 36 |
cmp -s codegroup codegroup2.bak ; if test $$? -ne 0 ; then \ |
| 37 |
echo '** codegroup: Command line file argument test failed. **' ; else \ |
| 38 |
echo 'All tests passed.' ; fi ; fi |
| 39 |
@rm codegroup1.bak codegroup2.bak |
| 40 |
|
| 41 |
# View manual page |
| 42 |
|
| 43 |
manpage: |
| 44 |
nroff -man codegroup.1 | $(PAGER) |
| 45 |
|
| 46 |
# Print manual page |
| 47 |
|
| 48 |
printman: |
| 49 |
groff -man codegroup.1 | lp |