1# $Id: Makefile,v 1.2 1999/12/04 00:01:20 wwg Exp $
2#----------------------------------------------------------------------
3# C O M P I L A T I O N :
4#----------------------------------------------------------------------
5#
6# To compile it all, just type:
7#
8#   $ make
9#
10# To force a complete recompile, do:
11#
12#   $ make clobber all
13#
14# If you don't have X server/libraries, compile as follows:
15#
16#   $ make no_x
17#
18#----------------------------------------------------------------------
19# I N S T A L L A T I O N :
20#----------------------------------------------------------------------
21#
22# To install everything (wavplay, wavrec and xltwavplay):
23#
24# # make install
25#
26# To install wavplay and wavrec only (no X based programs):
27#
28# # make install_no_x
29#
30# To add realtime scheduling do:
31#
32# # make setuid_root
33
34#----------------------------------------------------------------------
35# C O N F I G U R A T I O N   S E C T I O N :
36#----------------------------------------------------------------------
37
38#----------------------------------------------------------------------
39# If you are running a 386 you should comment this line out.
40#
41#CPU=-m486
42
43#----------------------------------------------------------------------
44# If you are experiencing troubles (like core dumps!), then uncomment
45# the DEBUG= line and comment out the OPT= line, and recompile. When
46# turning off debug, you may want to uncomment the OPT= line. Also
47# adjust the STRIP option to suit compile mode:
48#
49#DEBUG=-g
50#OPT=-O2
51
52#----------------------------------------------------------------------
53# When using 'DEBUG=-g' above, then comment out the 'strip' line:
54#
55STRIP=strip
56#STRIP=echo
57
58#----------------------------------------------------------------------
59# This parameter indicates where the program binaries should be
60# placed (wavplay, wavrec, and xltwavplay)
61#
62PREFIX?=/usr/local
63INSTDIR=$(PREFIX)/bin
64MANDIR=$(PREFIX)/man/man1
65
66#----------------------------------------------------------------------
67# Uncomment this line if you want to install the xltwavplay.res resource
68# file into your resource file(s) directory, instead of relying on the
69# builtin fallback resources in the program itself. If you don't know
70# what this is all about, then leave the next line commented out.
71#
72#USERES=-DINSTALLED_RESOURCE_FILE
73
74#----------------------------------------------------------------------
75# If the resource file is to be installed, indicate where. If the above
76# parameter is commented out, then this parameter is ignored.
77#
78RESDIR=/usr/X11R6/lib/X11/app-defaults
79
80#----------------------------------------------------------------------
81# If you don't have libXmu.so (which you should have) or you simply
82# don't want EDITRES capability in xltwavplay, then uncomment this
83# to disable the EDITRES facility. If you're not compiling xltwavplay
84# then this setting can be left asis.
85#
86NOEDITRES=-DNO_EDITRES
87
88#----------------------------------------------------------------------
89# If you COMMENTED OUT the NOEDITRES line, then UNCOMMENT this line.
90# If you UNCOMMENTED the NOEDITRES line, then COMMENT out this line.
91# (ie. do the opposite of NOEDITRES)
92#
93#LIBXMU=-lXmu
94
95#----------------------------------------------------------------------
96# These are the non X load options (for wavplay/wavrec)
97#
98LDOPTS=
99
100#----------------------------------------------------------------------
101# These are the MOTIF/LessTif + X load options (for xltwavplay)
102# Make sure that -lXm is always placed before -lXt
103#
104XLDOPTS=-L/usr/X11R6/lib/ -L/usr/local/lesstif/lib -lXm $(LIBXMU) -lXt -lX11
105
106#----------------------------------------------------------------------
107# When UNcommented, this causes the wavplay/wavrec programs to be compiled to use
108# only the standard getopt() routine. When commented out, the long options like --help
109# are recognized, with the help of the getopt_long() routine.
110#
111STDGETOPTS= -DUSE_GETOPT_STD
112
113#----------------------------------------------------------------------
114#
115# Uncomment this when compiling on FreeBSD.
116
117EXTRAOPTS=-DFREEBSD -D__GNU_LIBRARY__
118
119#----------------------------------------------------------------------
120# The next option specifies the pathname that the xltwavplay X client should exec
121# when starting the wavplay server program. This should be a full pathname.
122#
123# Environment variable WAVPLAYPATH will override this value at runtime, if
124# present.
125#
126PLAYPATH= -DWAVPLAYPATH=\"$(INSTDIR)/wavplay\"
127
128#----------------------------------------------------------------------
129# Minimum DSP sampling rate (default is 4000)
130#
131#DSPMIN= -DDSP_MIN=4000
132
133#----------------------------------------------------------------------
134# Maximum DSP sampling rate (default is 48000)
135#
136#DSPMAX= -DDSP_MAX=48000
137
138#----------------------------------------------------------------------
139# Pathname of the audio device (default is /dev/dsp)
140#
141# Environment variable DSPPATH will override this value at runtime, if
142# present.
143#
144DSPPATH= -DAUDIODEV=\"/dev/audio\"
145
146#----------------------------------------------------------------------
147# Semaphore IPC Key for the Play & Record locks (Default is 0x33333333)
148#
149# Environment variable DSPLOCKS will override this value at runtime, if
150# present.
151#
152#DSPLOCKS= -DAUDIOLCK=0x33333333
153
154#----------------------------------------------------------------------
155# Comment out this next parameter, if your kernel does not support
156# the sched_setscheduler() call (probably all kernels prior to 2.x.x)
157# The priority must be in the range of 1-99. Note however, that this
158# requires root privileges to do, and so wavplay must run setuid root.
159#
160SCHED_PRIORITY=-DSCHED_PRIORITY=9
161
162#----------------------------------------------------------------------
163# Only for unusual sites would you change this: the name of the
164# install program. (has no impact if you choose to manually install)
165#
166INSTALL=install
167
168#----------------------------------------------------------------------
169# If you have any custom include directories, like for X or
170# MOTIF/LessTif files, uncomment, and modify to suit (but normally
171# this should be unecessary if the appropriate symlinks are
172# installed).
173#
174#CUSTINCL= -I${LOCALBASE}/include/X11 -I${LOCALBASE}/include/Xm -I/${LOCALBASE}/include
175
176#----------------------------------------------------------------------
177# Normally, you shouldn't need to change anything beyond this point:
178#----------------------------------------------------------------------
179.SUFFIXES: .c .cc .h .o
180
181CUSTMOPTS=$(STDGETOPTS) $(EXTRAOPTS) $(PLAYPATH) $(DSPMIN) $(DSPMAX) $(DSPPATH) $(DSPLOCKS) $(USERES) $(NOEDITRES) $(SCHED_PRIORITY)
182ELF=	# -fPIC
183INCL=	-I. $(CUSTINCL)
184CCFLAGS+= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -fhandle-exceptions $(CUSTMOPTS) -Wall -Wstrict-prototypes
185CFLAGS+= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -Wall -Wstrict-prototypes $(CUSTMOPTS)
186CC?=	gcc
187CP=	g++
188
189HDRFIL= client.h server.h wavfile.h wavplay.h xltwavplay.h xmsprint.h
190SVROBJ=	main.o file.o recplay.o wavfile.o locks.o msg.o server.o
191CLNOBJ=	client.o msg.o xmsprint.o xltwavplay.o menu.o procterm.o save_as.o
192WVDMPO= wavdump.o
193
194.cc.o:
195	$(CP) $(CCFLAGS) $(INCL) $<
196
197.c.o:
198	$(CC) $(CFLAGS) $(INCL) $<
199
200all:	wavplay wavrec
201
202with_x:	wavplay wavrec xltwavplay
203
204# wavdump: $(WVDMPO)
205#	$(CP) $(WVDMPO) $(LDOPTS) $(DEBUG) -o wavdump -lRIFF
206
207wavplay: $(SVROBJ)
208	$(CC) $(SVROBJ) $(LDOPTS) $(DEBUG) -o wavplay
209	ls -l wavplay
210
211wavrec:	wavplay
212	rm -f wavrec
213	ln wavplay wavrec
214
215xltwavplay: $(CLNOBJ) xltwavplay.o
216	$(CC) $(CLNOBJ) $(XLDOPTS) $(DEBUG) -o xltwavplay
217	$(STRIP) xltwavplay
218	ls -l xltwavplay
219
220install: install_wavplay install_man
221
222install_with_x: install_wavplay install_xltwavplay install_man
223
224install_wavplay: wavplay wavrec
225	mkdir -p $(INSTDIR)
226	${BSD_INSTALL_PROGRAM} wavplay $(INSTDIR)
227	rm -f $(INSTDIR)/wavrec
228	ln $(INSTDIR)/wavplay $(INSTDIR)/wavrec
229	@echo
230
231install_man: wavplay.1
232	mkdir -p $(MANDIR)
233	${BSD_INSTALL_MAN} wavplay.1 $(MANDIR)
234
235xltwavplay_test: wavplay xltwavplay
236	WAVPLAYPATH=./wavplay ./xltwavplay
237
238setuid_root:
239	@[ -z "$(SCHED_PRIORITY)" ] && echo "No real time scheduling was compiled in. Check SCHED_PRIORITY." && exit 13 || :
240	chmod u+s $(INSTDIR)/wavplay
241	@ls -dlL $(INSTDIR)/wavplay
242	@echo "***************************************************************************************"
243	@echo "*** YOU REMAIN RESPONSIBLE FOR THE POSSIBLE SECURITY RISKS THAT SETUID ROOT IMPLIES ***"
244	@echo "***************************************************************************************"
245	@echo
246
247install_xltwavplay: xltwavplay
248	${BSD_INSTALL_PROGRAM} xltwavplay $(INSTDIR)
249	@[ ! -z "$(USERES)" ] \
250		&& ${BSD_INSTALL_DATA} xltwavplay.res $(RESDIR)/xltwavplay \
251		&& ls -dlL $(RESDIR)/xltwavplay/xltwavplay.res \
252		|| rm -f $(RESDIR)/xltwavplay
253
254clean:
255	rm -f *.o a.out core t.t errs.t
256
257clobber: clean
258	rm -f xltwavplay wavplay wavrec
259
260DISTRELEASE=wavplay-1.4
261MANIFEST= BUGS COPYING INSTALL README wavplay.1 wavplay.lsm xltwavplay.res \
262	Makefile client.h server.h wavfile.h wavplay.h xmsprint.h xltwavplay.h \
263	client.c file.c locks.c main.c menu.c msg.c procterm.c recplay.c save_as.c \
264	server.c wavfile.c xltwavplay.c xmsprint.c \
265
266dist:	clobber
267	rm -fr $(DISTRELEASE) $(DISTRELEASE).tar $(DISTRELEASE).tar.gz
268	mkdir $(DISTRELEASE)
269	cp $(MANIFEST) $(DISTRELEASE)/.
270	mv $(DISTRELEASE)/wavplay.lsm $(DISTRELEASE)/$(DISTRELEASE).lsm
271	tar czf $(DISTRELEASE).tar.gz $(DISTRELEASE)
272	@ls -l $(DISTRELEASE).tar.gz
273
274zonk:   clobber
275	rm -fr $(DISTRELEASE) $(DISTRELEASE).tar $(DISTRELEASE).tar.gz
276
277# $Log: Makefile,v $
278# Revision 1.2  1999/12/04 00:01:20  wwg
279# Implement wavplay-1.4 release changes
280#
281