File: Makefile

package info (click to toggle)
unixcw 1.1a-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 264 kB
  • ctags: 301
  • sloc: ansic: 2,491; makefile: 120; sh: 24
file content (196 lines) | stat: -rw-r--r-- 5,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#
# Makefile for G0FRD CW tutor for UNIX flavours
# Copyright (C) 1998  Simon Baldwin (simonb@sco.com)
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#
# The following UNIX variants are available:
#
#   Linux: IBM PC Console running Linux.
#   SCO:   IBM PC Console running SCO OpenServer.
#   UW2:   IBM PC Console running SCO UnixWare 2.1.
#   UW7:   IBM PC Console running SCO UnixWare 7.
#

# Start of platform-specific information

# select the C compiler
#CC	= gcc	- for Linux
#CC	= cc	- for SCO OpenServer
#CC	= cc	- for SCO UnixWare 2.1
#CC	= cc	- for SCO UnixWare 7
CC	= gcc

# C compiler flags necessary to compile the programs correctly
#CFLAGS	= -DLINUX	- for Linux
#CFLAGS	= -DSCO -bELF	- for SCO OpenServer (optional -bELF)
#CFLAGS	= -DUNIXWARE2	- for SCO UnixWare 2.1
#CFLAGS	= -DUNIXWARE7	- for SCO UnixWare 7
CFLAGS	= -DLINUX

# curses library
#LCURSES	= -lncurses	- for Linux
#LCURSES	= -lcurses	- for SCO OpenServer
#LCURSES	= -lcurses	- for SCO UnixWare 2.1
#LCURSES	= -lcurses	- for SCO UnixWare 7
LCURSES	= -lncurses

#ICURSES	= -I/usr/include/ncurses	- for Linux
#ICURSES	= 				- for SCO OpenServer
#ICURSES	= 				- for SCO UnixWare 2.1
#ICURSES	= 				- for SCO UnixWare 7
ICURSES	= -I/usr/include/ncurses

# variable targets for platforms
#T_MAN	= linux_mans	- for Linux
#T_MAN	= nonlinux_mans	- for SCO OpenServer
#T_MAN	= nonlinux_mans	- for SCO UnixWare 2.1
#T_MAN	= nonlinux_mans	- for SCO UnixWare 7
T_MAN	= linux_mans

#T_INSTALL	= linux_install		- for Linux
#T_INSTALL	= nonlinux_install	- for SCO OpenServer
#T_INSTALL	= nonlinux_install	- for SCO UnixWare 2.1
#T_INSTALL	= nonlinux_install	- for SCO UnixWare 7
T_INSTALL	= linux_install

#T_UNINSTALL	= linux_uninstall	- for Linux
#T_UNINSTALL	= nonlinux_uninstall	- for SCO OpenServer
#T_UNINSTALL	= nonlinux_uninstall	- for SCO UnixWare 2.1
#T_UNINSTALL	= nonlinux_uninstall	- for SCO UnixWare 7
T_UNINSTALL	= linux_uninstall

# End of platform-specific information

# information for the installation
BINDIR	= /usr/local/bin
MANDIR	= /usr/local/man/man1
OWNER	= root:root
MODE	= 755


# default make target
default:	bins manpages install

# do everything
all:	bins manpages install test1 test2

# build the tutor binaries
bins:	cw cwgen cwcp

cw:	cw.h cw.c
	$(CC) $(CFLAGS) -o cw cw.c
	strip cw

cwgen:	cwgen.c
	$(CC) $(CFLAGS) -o cwgen cwgen.c
	strip cwgen

cwcp:	cw.h cwcp.c
	$(CC) $(CFLAGS) $(ICURSES) -o cwcp cwcp.c $(LCURSES)
	strip cwcp

# build manpages in different formats; useful for SCO where *roff
# is not available by default
manpages:	$(T_MAN)

linux_mans:	cw.1.ps cw.1.cat cwgen.1.ps cwgen.1.cat cwcp.1.ps cwcp.1.cat

cw.1.ps:	cw.1
	-man -t ./cw.1 >|cw.1.ps

cw.1.cat:	cw.1
	-man ./cw.1 >|cw.1.cat

cwgen.1.ps:	cwgen.1
	-man -t ./cwgen.1 >|cwgen.1.ps

cwgen.1.cat:	cwgen.1
	-man ./cwgen.1 >|cwgen.1.cat

cwcp.1.ps:	cwcp.1
	-man -t ./cwcp.1 >|cwcp.1.ps

cwcp.1.cat:	cwcp.1
	-man ./cwcp.1 >|cwcp.1.cat

nonlinux_mans:
	echo "Make for manpages not available on non-Linux platforms"

# install the binaries and man pages
install:	$(T_INSTALL)

linux_install:
	-mkdir -p $(BINDIR)
	-mkdir -p $(MANDIR)
	cp cw $(BINDIR)
	chown $(OWNER) $(BINDIR)/cw
	chmod $(MODE) $(BINDIR)/cw
	cp cwgen $(BINDIR)
	chown $(OWNER) $(BINDIR)/cwgen
	chmod $(MODE) $(BINDIR)/cwgen
	cp cwcp $(BINDIR)
	chown $(OWNER) $(BINDIR)/cwcp
	chmod $(MODE) $(BINDIR)/cwcp
	gzip -c cw.1 >$(MANDIR)/cw.1.gz
	chown $(OWNER) $(MANDIR)/cw.1.gz
	chmod $(MODE) $(MANDIR)/cw.1.gz
	gzip -c cwgen.1 >$(MANDIR)/cwgen.1.gz
	chown $(OWNER) $(MANDIR)/cwgen.1.gz
	chmod $(MODE) $(MANDIR)/cwgen.1.gz
	gzip -c cwcp.1 >$(MANDIR)/cwcp.1.gz
	chown $(OWNER) $(MANDIR)/cwcp.1.gz
	chmod $(MODE) $(MANDIR)/cwcp.1.gz

nonlinux_install:
	-mkdir -p $(BINDIR)
	cp cw $(BINDIR)
	chown $(OWNER) $(BINDIR)/cw
	chmod $(MODE) $(BINDIR)/cw
	cp cwgen $(BINDIR)
	chown $(OWNER) $(BINDIR)/cwgen
	chmod $(MODE) $(BINDIR)/cwgen
	cp cwcp $(BINDIR)
	chown $(OWNER) $(BINDIR)/cwcp
	chmod $(MODE) $(BINDIR)/cwcp

# run tests on the binaries built
test1:
	./cw -w25 <cwtest1.cw

test2:
	./cw <cwtest2.cw

# uninstall the binaries and man pages
uninstall:	$(T_UNINSTALL)

linux_uninstall:
	-rm -f $(BINDIR)/cw $(BINDIR)/cwgen $(BINDIR)/cwcp
	-rmdir $(BINDIR)
	-rm -f $(MANDIR)/cw.1.gz $(MANDIR)/cwgen.1.gz $(MANDIR)/cwcp.1.gz
	-rmdir $(MANDIR)

nonlinux_uninstall:
	-rm -f $(BINDIR)/cw $(BINDIR)/cwgen $(BINDIR)/cwcp
	-rmdir $(BINDIR)

# clear up for a rebuild
clean:
	-rm -f *.o cw cwgen cwcp *.1.ps *.1.cat

# completely remove
clobber: clean uninstall