1# DJGPP Makefile ATP utilities (for use with GNU Make)
2# tested with GNU Make
3
4DEFS	=
5CC	= gcc
6CFLAGS	= -O
7LDFLAGS	=
8SED	= edlin
9STRIP	= strip
10INSTALL	= xcopy
11PERL	= perl
12SHELL	= command.com
13MV	= rename
14RM	= @-del
15
16prefix	= \usr\local
17exec_prefix = $(prefix)
18bindir	= $(exec_prefix)\bin
19mandir	= $(prefix)\man\man1
20
21#manown	= -o daemon -g daemon
22#binown	= -o bin -g bin
23
24%.exe : %.cof
25	$(STRIP) $<
26	coff2exe $<
27
28all: ansi2knr.exe rot13.exe atpdiag.bat
29
30ansi2knr.exe: ansi2knr.cof
31
32rot13.exe: rot13.cof
33
34ifneq ($(SED),edlin)  # we use sed:
35
36atpdiag.bat: atpdiag.in
37	$(SED) -e 4,7d -e s/@PERLPATH@/$(PERL)/ -e /@OS2@/d -e /@UNIX@/d atpdiag.in > atpdiag.tmp
38	@if exist $@ del $@
39	$(MV) atpdiag.tmp $@
40
41else  # we use edlin:
42
43atpdiag.bat: atpdiag.in
44	copy atpdiag.in atpdiag.tmp
45	echo 5,8d s@UNIX@>mysed.tmp
46	echo .d s@UNIX@>>mysed.tmp
47	echo .d s@OS2@>>mysed.tmp
48	echo .d e >>mysed.tmp
49	edlin atpdiag.tmp <mysed.tmp
50	@if exist $@ del $@
51	$(MV) atpdiag.tmp $@
52	@del mysed.tmp
53
54endif
55
56ansi2knr.cof: ansi2knr.c stdio_.h string_.h malloc_.h
57	$(CC) $(CFLAGS) -o ansi2knr.cof ansi2knr.c $(LDFLAGS)
58
59rot13.cof:   rot13.c
60	$(CC) $(CFLAGS) $(DEFS) -o rot13.cof rot13.c
61
62convert: ansi2knr.exe
63	.\ansi2knr rot13.c >ansi.tmp
64	$(MV) rot13.c rot13.c~
65	$(MV) ansi.tmp rot13.c
66	echo "convert" >convert
67
68unconvert: rot13.c~
69	@if exist rot13.c del rot13.c
70	$(MV) rot13.c~ rot13.c
71	@if exist convert del convert
72
73install: ansi2knr.exe ansi2knr.1 atpdiag.bat atpdiag.1 rot13.exe rot13.1
74	$(INSTALL) rot13.exe $(bindir)
75	$(INSTALL) rot13.1 $(mandir)
76	$(INSTALL) ansi2knr.exe $(bindir)
77	$(INSTALL) ansi2knr.1 $(mandir)
78	$(INSTALL) atpdiag.bat $(bindir)
79	$(INSTALL) atpdiag.1 $(mandir)
80
81foo:
82	$(INSTALL) rot13.1 $(mandir)
83
84uninstall:
85	$(RM) $(bindir)/ansi2knr.exe
86	$(RM) $(mandir)/ansi2knr.1
87	$(RM) $(bindir)/atpdiag.bat
88	$(RM) $(mandir)/atpdiag.1
89	$(RM) $(bindir)/rot13.exe
90	$(RM) $(mandir)/rot13.1
91
92clean:
93	$(RM) ansi2knr.exe
94	$(RM) ansi.tmp
95	$(RM) core
96	$(RM) erro
97	$(RM) *.o
98	$(RM) atpdiag.tmp
99	$(RM) rot13.exe
100	$(RM) *.cof
101
102mostlyclean: clean
103	if exist atpdiag.bat del atpdiag.bat
104
105clobber: clean
106	$(RM) atpdiag.bat
107	$(RM) *.bak
108	$(RM) *.obj
109	$(RM) *.map
110	$(RM) *.lib
111
112distclean: clobber
113	$(RM) atpdiag
114	$(RM) atpdiag.cmd
115	$(RM) atpdiag.bat
116	$(RM) ansi2knr
117	$(RM) ansi2knr.exe
118	$(RM) rot13
119	$(RM) rot13.exe
120	$(RM) *.bat
121
122depend:
123	$(CC) -MM $(CFLAGS) ansi2knr.c rot13.c >depend
124
125