a6348f1c4439e4d6c62a28dcad55864491f5405a
[xscreensaver] / driver / Makefile.in
1 # driver/Makefile.in --- xscreensaver, Copyright (c) 1997-2005 Jamie Zawinski.
2 # the `../configure' script generates `driver/Makefile' from this file.
3
4 @SET_MAKE@
5 .SUFFIXES:
6 .SUFFIXES: .c .m .o
7
8 srcdir          = @srcdir@
9 VPATH           = @srcdir@
10 top_srcdir      = @top_srcdir@
11 top_builddir    = ..
12
13 install_prefix  =
14 prefix          = @prefix@
15 exec_prefix     = @exec_prefix@
16 bindir          = @bindir@
17 datarootdir     = @datarootdir@
18 datadir         = @datadir@
19 localedir       = $(datadir)/locale
20 mandir          = @mandir@
21 libexecdir      = @libexecdir@
22 mansuffix       = 1
23 manNdir         = $(mandir)/man$(mansuffix)
24
25 INTLTOOL_MERGE  = @INTLTOOL_MERGE@
26
27 GTK_DATADIR     = @GTK_DATADIR@
28 GTK_APPDIR      = $(GTK_DATADIR)/applications
29 GTK_ICONDIR     = $(GTK_DATADIR)/pixmaps
30 GTK_GLADEDIR    = $(GTK_DATADIR)/xscreensaver/glade
31 HACK_CONF_DIR   = @HACK_CONF_DIR@
32
33 CC              = @CC@
34 OBJCC           = @OBJCC@
35 CFLAGS          = @CFLAGS@
36 LDFLAGS         = @LDFLAGS@
37 DEFS            = @DEFS@
38 INTL_DEFS       = -DLOCALEDIR=\"$(localedir)\"
39 SUBP_DEFS       = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"'
40 GTK_DEFS        = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"'
41 CONF_DEFS       = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
42
43 LIBS            = @LIBS@
44 INTL_LIBS       = @INTLLIBS@
45 JPEG_LIBS       = @JPEG_LIBS@
46 PERL            = @PERL@
47
48 DEPEND          = @DEPEND@
49 DEPEND_FLAGS    = @DEPEND_FLAGS@
50 DEPEND_DEFINES  = @DEPEND_DEFINES@
51
52 SHELL           = /bin/sh
53 INSTALL         = @INSTALL@
54 SUID_FLAGS      = -o root -m 4755
55 INSTALL_PROGRAM = @INSTALL_PROGRAM@
56 INSTALL_SCRIPT  = @INSTALL_SCRIPT@
57 INSTALL_SETUID  = @INSTALL_SETUID@
58 INSTALL_DATA    = @INSTALL_DATA@
59 INSTALL_DIRS    = @INSTALL_DIRS@
60
61 X_CFLAGS        = @X_CFLAGS@
62 X_LIBS          = @X_LIBS@
63 X_PRE_LIBS      = @X_PRE_LIBS@
64 X_EXTRA_LIBS    = @X_EXTRA_LIBS@
65 XMU_LIBS        = @XMU_LIBS@
66 XPM_LIBS        = @XPM_LIBS@
67
68 # Note:
69 #
70 # X_LIBS would more properly be called X_LDFLAGS (it contains the -L args.)
71 # X_PRE_LIBS contains extra libraries you have to link against on some systems,
72 #         and that must come before -lX11.  (e.g., -lSM and -lICE.)
73 # X_EXTRA_LIBS contains extra libraries needed by X that aren't a part of X.
74 #         (e.g., -lsocket, -lnsl, etc.)
75 #
76 # I think (but am not totally sure) that LIBS is also really "LDFLAGS".
77 #
78 # SAVER_LIBS is the link line for "xscreensaver", and
79 # CMD_LIBS is the link line for "xscreensaver-command".
80 # GETIMG_LIBS is the link line for "xscreensaver-getimage".
81
82
83 AD_DIR          = @APPDEFAULTS@
84 PAM_DIR         = /etc/pam.d
85 PAM_CONF        = /etc/pam.conf
86
87 UTILS_SRC       = $(srcdir)/../utils
88 UTILS_BIN       = ../utils
89
90 INCLUDES        = -I. -I$(srcdir) -I$(UTILS_SRC) -I.. @INCLUDES@
91
92 MOTIF_SRCS      = demo-Xm.c demo-Xm-widgets.c
93 MOTIF_OBJS      = demo-Xm.o demo-Xm-widgets.o
94
95 GTK_SRCS        = demo-Gtk.c demo-Gtk-conf.c \
96                   demo-Gtk-widgets.c demo-Gtk-support.c
97 GTK_EXTRA_OBJS  = demo-Gtk-widgets.o demo-Gtk-support.o
98 GTK_OBJS        = demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@
99
100 PWENT_SRCS      = passwd-pwent.c
101 PWENT_OBJS      = passwd-pwent.o
102
103 KERBEROS_SRCS   = passwd-kerberos.c
104 KERBEROS_OBJS   = passwd-kerberos.o
105
106 PAM_SRCS        = passwd-pam.c
107 PAM_OBJS        = passwd-pam.o
108
109 PWHELPER_SRCS   = passwd-helper.c
110 PWHELPER_OBJS   = passwd-helper.o
111
112 LOCK_SRCS_1     = lock.c passwd.c
113 LOCK_OBJS_1     = lock.o passwd.o
114 NOLOCK_SRCS_1   = lock.c
115 NOLOCK_OBJS_1   = lock.o
116
117 TEST_SRCS       = test-passwd.c test-uid.c  test-xdpms.c    test-grab.c \
118                   test-apm.c    test-fade.c test-xinerama.c test-vp.c   \
119                   test-randr.c  xdpyinfo.c  test-mlstring.c test-screens.c
120 TEST_EXES       = test-passwd   test-uid    test-xdpms      test-grab   \
121                   test-apm      test-fade   test-xinerama   test-vp     \
122                   test-randr    xdpyinfo    test-mlstring   test-screens
123
124 MOTIF_LIBS      = @MOTIF_LIBS@ @XPM_LIBS@ $(XMU_LIBS)
125 GTK_LIBS        = @GTK_LIBS@ $(XMU_LIBS)
126 XML_LIBS        = @XML_LIBS@
127
128 XDPMS_LIBS      = @XDPMS_LIBS@
129 XINERAMA_LIBS   = @XINERAMA_LIBS@
130
131 PASSWD_SRCS     = @PASSWD_SRCS@
132 PASSWD_OBJS     = @PASSWD_OBJS@
133 PASSWD_LIBS     = @PASSWD_LIBS@
134
135 LOCK_SRCS       = @LOCK_SRCS@
136 LOCK_OBJS       = @LOCK_OBJS@
137
138 XMU_SRCS        = @XMU_SRCS@
139 XMU_OBJS        = @XMU_OBJS@
140
141 GL_SRCS         = @SAVER_GL_SRCS@
142 GL_OBJS         = @SAVER_GL_OBJS@
143 GL_LIBS         = @SAVER_GL_LIBS@
144
145 ICON_SRC        = $(UTILS_SRC)/images
146 LOGO            = $(ICON_SRC)/logo-50.xpm
147 GTK_ICONS       = $(ICON_SRC)/screensaver-*.png
148
149 DEMO_UTIL_SRCS  = $(UTILS_SRC)/resources.c $(UTILS_SRC)/usleep.c \
150                   $(UTILS_SRC)/visual.c $(XMU_SRCS)
151 DEMO_UTIL_OBJS  = $(UTILS_BIN)/resources.o $(UTILS_BIN)/usleep.o \
152                   $(UTILS_BIN)/visual.o $(XMU_OBJS)
153
154 SAVER_UTIL_SRCS = $(UTILS_SRC)/fade.c $(UTILS_SRC)/overlay.c \
155                   $(UTILS_SRC)/logo.c $(UTILS_SRC)/yarandom.c \
156                   $(UTILS_SRC)/minixpm.c \
157                   $(DEMO_UTIL_SRCS)
158 SAVER_UTIL_OBJS = $(UTILS_BIN)/fade.o $(UTILS_BIN)/overlay.o \
159                   $(UTILS_BIN)/logo.o $(UTILS_BIN)/yarandom.o \
160                   $(UTILS_BIN)/minixpm.o \
161                   $(DEMO_UTIL_OBJS)
162
163 GETIMG_SRCS_1   = xscreensaver-getimage.c
164 GETIMG_OBJS_1   = xscreensaver-getimage.o
165
166 GETIMG_SRCS     = $(GETIMG_SRCS_1) \
167                   $(UTILS_BIN)/colorbars.o $(UTILS_BIN)/resources.o \
168                   $(UTILS_BIN)/yarandom.o $(UTILS_BIN)/visual.o \
169                   $(UTILS_BIN)/usleep.o $(UTILS_BIN)/hsv.o \
170                   $(UTILS_BIN)/colors.o $(UTILS_BIN)/grabscreen.o \
171                   $(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o prefs.o \
172                   $(XMU_SRCS)
173
174 GETIMG_OBJS     = $(GETIMG_OBJS_1) \
175                   $(UTILS_BIN)/colorbars.o $(UTILS_BIN)/resources.o \
176                   $(UTILS_BIN)/yarandom.o $(UTILS_BIN)/visual.o \
177                   $(UTILS_BIN)/usleep.o $(UTILS_BIN)/hsv.o \
178                   $(UTILS_BIN)/colors.o $(UTILS_BIN)/grabscreen.o \
179                   $(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o prefs.o \
180                   $(XMU_OBJS)
181
182 SAVER_SRCS_1    = xscreensaver.c windows.c screens.c timers.c subprocs.c \
183                   exec.c xset.c splash.c setuid.c stderr.c mlstring.c
184 SAVER_OBJS_1    = xscreensaver.o windows.o screens.o timers.o subprocs.o \
185                   exec.o xset.o splash.o setuid.o stderr.o mlstring.o
186
187 SAVER_SRCS      = $(SAVER_SRCS_1) prefs.c dpms.c $(LOCK_SRCS) \
188                   $(SAVER_UTIL_SRCS) $(GL_SRCS)
189 SAVER_OBJS      = $(SAVER_OBJS_1) prefs.o dpms.o $(LOCK_OBJS) \
190                   $(SAVER_UTIL_OBJS) $(GL_OBJS)
191
192 CMD_SRCS        = remote.c xscreensaver-command.c
193 CMD_OBJS        = remote.o xscreensaver-command.o
194
195 DEMO_SRCS_1     = prefs.c dpms.c
196 DEMO_OBJS_1     = prefs.o dpms.o
197
198 DEMO_SRCS       = $(DEMO_SRCS_1) remote.c exec.c $(DEMO_UTIL_SRCS)
199 DEMO_OBJS       = $(DEMO_OBJS_1) remote.o exec.o $(DEMO_UTIL_OBJS)
200
201 PDF2JPEG_SRCS   = pdf2jpeg.m
202 PDF2JPEG_OBJS   = pdf2jpeg.o
203 PDF2JPEG_LIBS   = -framework Cocoa
204
205 SAVER_LIBS      = $(LIBS) $(X_LIBS) $(XMU_LIBS) @SAVER_LIBS@ \
206                   $(XDPMS_LIBS) $(XINERAMA_LIBS) $(GL_LIBS) $(X_PRE_LIBS) \
207                   -lXt -lX11 -lXext $(X_EXTRA_LIBS) \
208                   $(PASSWD_LIBS)
209
210 CMD_LIBS        = $(LIBS) $(X_LIBS) \
211                   $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS)
212
213 GETIMG_LIBS     = $(LIBS) $(X_LIBS) $(XPM_LIBS) $(JPEG_LIBS) \
214                   $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS)
215
216 EXES            = xscreensaver xscreensaver-command xscreensaver-demo \
217                   xscreensaver-getimage @EXES_OSX@
218 EXES2           = @ALL_DEMO_PROGRAMS@
219 EXES_OSX        = pdf2jpeg
220
221 SCRIPTS_1       = xscreensaver-getimage-file xscreensaver-getimage-video \
222                   xscreensaver-text
223 SCRIPTS_OSX     = xscreensaver-getimage-desktop
224 SCRIPTS         = $(SCRIPTS_1) @SCRIPTS_OSX@
225
226 HDRS            = XScreenSaver_ad.h XScreenSaver_Xm_ad.h \
227                   xscreensaver.h prefs.h remote.h exec.h \
228                   demo-Gtk-widgets.h demo-Gtk-stubs.h demo-Gtk-support.h \
229                   demo-Gtk-conf.h auth.h mlstring.h types.h
230 MEN_1           = xscreensaver.man xscreensaver-demo.man \
231                   xscreensaver-command.man \
232                   xscreensaver-text.man \
233                   xscreensaver-getimage.man \
234                   xscreensaver-getimage-file.man \
235                   xscreensaver-getimage-video.man
236 MEN_OSX         = xscreensaver-getimage-desktop.man pdf2jpeg.man
237 MEN             = $(MEN_1) @MEN_OSX@
238
239 EXTRAS          = README Makefile.in \
240                   XScreenSaver.ad.in XScreenSaver-Xm.ad xscreensaver.pam \
241                   xscreensaver-demo.glade2 xscreensaver-demo.glade2p \
242                   screensaver-properties.desktop.in \
243                   .gdbinit
244 VMSFILES        = compile_axp.com compile_decc.com link_axp.com link_decc.com \
245                   vms-getpwnam.c vms-pwd.h vms-hpwd.c vms-validate.c \
246                   vms_axp.opt vms_axp_12.opt vms_decc.opt vms_decc_12.opt
247
248 TARFILES        = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
249                   $(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) $(PWHELPER_SRCS) \
250                   $(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \
251                   $(CMD_SRCS) $(GETIMG_SRCS_1) $(PDF2JPEG_SRCS) $(HDRS) \
252                   $(SCRIPTS_1) $(SCRIPTS_OSX) $(MEN_1) $(MEN_OSX) \
253                   $(TEST_SRCS)
254
255
256 default: $(EXES)
257 all: $(EXES) $(EXES2)
258 tests: $(TEST_EXES)
259
260 install:   install-program   install-ad    install-scripts \
261            install-gnome     install-man   install-xml install-pam
262 uninstall: uninstall-program uninstall-ad  \
263            uninstall-gnome   uninstall-man uninstall-xml  
264
265 install-strip:
266         $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
267                 install
268
269 install-program: $(EXES)
270         @if [ ! -d $(install_prefix)$(bindir) ]; then                   \
271           $(INSTALL_DIRS) $(install_prefix)$(bindir) ;                  \
272          fi
273         @inst="$(INSTALL_PROGRAM)" ;                                    \
274         if [ @NEED_SETUID@ = yes ]; then                                \
275            me=`PATH="$$PATH:/usr/ucb" whoami` ;                         \
276            if [ "$$me" = root ]; then                                   \
277              inst="$(INSTALL_SETUID)" ;                                 \
278            else                                                         \
279             e=echo ;                                                    \
280  $$e ""                                                                      ;\
281  $$e "  ####################################################################";\
282  $$e "  Warning: xscreensaver has been compiled with support for shadow"     ;\
283  $$e "           passwords.  If your system actually uses shadow passwords," ;\
284  $$e "           then xscreensaver must be installed as a setuid root"       ;\
285  $$e "           program in order for locking to work.  To do this, you"     ;\
286  $$e "           must run 'make install' as 'root', not as '$$me'."          ;\
287  $$e ""                                                                      ;\
288  $$e "           For now, xscreensaver will be installed non-setuid, which"  ;\
289  $$e "           means that locking might not work.  (Try it and see.)"      ;\
290  $$e "  ####################################################################";\
291  $$e ""                                                                      ;\
292            fi ;                                                               \
293         fi ;                                                                  \
294         echo $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver ;    \
295         $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver
296         @for exe in xscreensaver-command xscreensaver-demo                 \
297                     xscreensaver-getimage @EXES_OSX@ ; do                  \
298           echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
299                $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
300          done
301
302 install-ad: XScreenSaver.ad
303         @if [ ! -d $(install_prefix)$(AD_DIR) ]; then                         \
304           $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ;                        \
305          fi
306         @-echo $(INSTALL_DATA) XScreenSaver.ad                                \
307           $(install_prefix)$(AD_DIR)/XScreenSaver ;                           \
308         if $(INSTALL_DATA) XScreenSaver.ad                                    \
309           $(install_prefix)$(AD_DIR)/XScreenSaver ; then                      \
310           true ;                                                              \
311         else                                                                  \
312           e=echo ;                                                            \
313           if [ -f $(install_prefix)$(AD_DIR)/XScreenSaver ]; then             \
314  $$e ""                                                                      ;\
315  $$e "  ####################################################################";\
316  $$e "  Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver"  ;\
317  $$e "           That file exists, and is unwritable.  It is probably from"  ;\
318  $$e "           an older version of xscreensaver, and could cause things"   ;\
319  $$e "           to malfunction.  Please delete it!"                         ;\
320  $$e "  ####################################################################";\
321  $$e ""                                                                      ;\
322             exit 1 ;                                                          \
323           else                                                                \
324  $$e ""                                                                      ;\
325  $$e "  ####################################################################";\
326  $$e "  Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver"  ;\
327  $$e "           The directory is unwritable.  This is probably ok;"         ;\
328  $$e "           xscreensaver should work without that file."                ;\
329  $$e "  ####################################################################";\
330  $$e ""                                                                      ;\
331             exit 0 ;                                                          \
332           fi                                                                  \
333         fi
334
335 install-scripts: $(SCRIPTS) munge-scripts
336         @for program in $(SCRIPTS); do                                  \
337           if [ -r $$program ] ; then                                    \
338             p=$$program ;                                               \
339           else                                                          \
340             p=$(srcdir)/$$program ;                                     \
341           fi ;                                                          \
342           echo $(INSTALL_SCRIPT) $$p                                    \
343             $(install_prefix)$(bindir)/$$program ;                      \
344           $(INSTALL_SCRIPT) $$p                                         \
345             $(install_prefix)$(bindir)/$$program ;                      \
346         done
347
348 munge-scripts: $(SCRIPTS)
349         @tmp=/tmp/mf.$$$$ ;                                             \
350         perl="${PERL}" ;                                                \
351         rm -f $$tmp ;                                                   \
352         for program in $(SCRIPTS); do                                   \
353           sed "s@^\(#!\)\(/[^ ]*/perl[^ ]*\)\(.*\)\$$@\1$$perl\3@"      \
354               < $(srcdir)/$$program > $$tmp ;                           \
355           if cmp -s $(srcdir)/$$program $$tmp ; then                    \
356             true ;                                                      \
357           else                                                          \
358             echo "$$program: setting interpreter to $$perl" >&2 ;       \
359             cat $$tmp > ./$$program ;                                   \
360           fi ;                                                          \
361         done ;                                                          \
362         rm -f $$tmp
363
364 # When installing man pages, we install "foo.man" as "foo.N" and update
365 # the .TH line in the installed file with one like
366 #
367 #     .TH XScreenSaver N "V.VV (DD-MMM-YYYY)" "X Version 11"
368 #
369 # where N is the manual section suffix.
370 #
371 install-man: $(MEN)
372         @men="$(MEN)" ;                                                 \
373         U=$(UTILS_SRC)/version.h ;                                      \
374         V=`sed -n 's/.*xscreensaver \([0-9]\.[^)]*)\).*/\1/p' < $$U` ;          \
375         T=/tmp/xs$$$$.$(mansuffix) ;                                    \
376         TH=".TH XScreenSaver $(mansuffix) \"$$V\" \"X Version 11\"" ;   \
377         echo "installing man pages: $$TH" ;                             \
378                                                                         \
379         if [ ! -d $(install_prefix)$(manNdir) ]; then                   \
380           $(INSTALL_DIRS) $(install_prefix)$(manNdir) ;                 \
381          fi ;                                                           \
382                                                                         \
383         for man in $$men; do                                            \
384           instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ;     \
385           manbase=`echo $$man | sed 's/\.man$$//'` ;    \
386           TH=".TH $$manbase $(mansuffix) \"$$V\" \"X Version 11\" \"XScreenSaver manual\"" ;    \
387           sed -e "s/^\.TH.*/$$TH/"                                      \
388               -e 's/^\(\.BR xscr.*(\)[^()]\(.*\)/\1$(mansuffix)\2/'     \
389               -e 's@(MANSUFFIX)@($(mansuffix))@g'                       \
390             < $(srcdir)/$$man > $$T ;                                   \
391           echo $(INSTALL_DATA) $(srcdir)/$$man                          \
392            $(install_prefix)$(manNdir)/$$instname ;                     \
393           $(INSTALL_DATA) $$T                                           \
394             $(install_prefix)$(manNdir)/$$instname ;                    \
395         done ;                                                          \
396         rm -f $$T
397
398 uninstall-program:
399         @for program in $(EXES) $(SCRIPTS); do                          \
400           echo rm -f $(install_prefix)$(bindir)/$$program ;             \
401           rm -f $(install_prefix)$(bindir)/$$program ;                  \
402         done
403
404 uninstall-ad:
405         rm -f $(install_prefix)$(AD_DIR)/XScreenSaver
406
407 uninstall-man:
408         @men="$(MEN)" ;                                                 \
409         for man in $$men; do                                            \
410           instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ;     \
411           echo rm -f $(install_prefix)$(manNdir)/$$instname* ;          \
412                rm -f $(install_prefix)$(manNdir)/$$instname* ;          \
413         done
414
415 install-pam:
416         @src="$(srcdir)/xscreensaver.pam" ;                             \
417         dest=`sed -n 's/.*PAM_SERVICE_NAME[     ]*"\([^"]*\)".*$$/\1/p' \
418            < ../config.h` ;                                             \
419         dir="$(install_prefix)$(PAM_DIR)" ;                             \
420         conf="$(PAM_CONF)" ;                                            \
421                                                                         \
422         if [ -d $$dir ] ; then                                          \
423                                                                         \
424           if [ -f $$dir/xdm ]; then                                     \
425             src2=$$dir/xdm ;                                            \
426           elif [ -f $$dir/login ]; then                                 \
427             src2=$$dir/login ;                                          \
428           fi ;                                                          \
429                                                                         \
430           if [ -z "$$src2" ]; then                                      \
431             echo $(INSTALL_DATA) $$src $$dir/$$dest ;                   \
432             $(INSTALL_DATA) $$src $$dir/$$dest ;                        \
433           else                                                          \
434             src="xscreensaver.pam.$$$$" ;                               \
435             echo "grep '^#%\|^auth\|^@include' $$src2 > $$src" ;        \
436                   grep '^#%\|^auth\|^@include' $$src2 > $$src  ;        \
437             echo $(INSTALL_DATA) $$src $$dir/$$dest ;                   \
438                  $(INSTALL_DATA) $$src $$dir/$$dest ;                   \
439             echo rm -f $$src ;                                          \
440                  rm -f $$src ;                                          \
441           fi ;                                                          \
442                                                                         \
443           if [ ! -f $$dir/$$dest ]; then                                \
444             e=echo ;                                                    \
445  $$e ""                                                                      ;\
446  $$e "  ####################################################################";\
447  $$e "  Warning: xscreensaver has been compiled with support for Pluggable"  ;\
448  $$e "           Authentication Modules (PAM).  However, we were unable to"  ;\
449  $$e "           install the file $$dir/$$dest.  PAM is unlikely"            ;\
450  $$e "           to work without this file (and old-style password"          ;\
451  $$e "           authentication will be used instead, which may or may not"  ;\
452  $$e "           work.)"                                                     ;\
453  $$e "  ####################################################################";\
454  $$e ""                                                                      ;\
455           fi ;                                                          \
456         elif [ -f $$conf -a "x$$dest" != "x" ]; then                    \
457           if ( grep $$dest $$conf >/dev/null ); then                    \
458            echo "$$conf unchanged: already has an entry for $$dest" ;   \
459           else                                                          \
460             src="pam.conf.$$$$" ;                                       \
461             echo "grep -v $$dest $$conf > $$src" ;                      \
462                   grep -v $$dest $$conf > $$src ;                       \
463             extras=`sed -n "s/^login\(.*auth.*\)$$/$$dest\1/p" $$conf`; \
464             echo "$$extras" >> $$src ;                                  \
465             if [ "x$$extras" = "x" ]; then                              \
466               echo "Error: no login rules in $$conf?" >&2 ;             \
467             else                                                        \
468               echo "adding $$dest rules to $$src:" ;                    \
469               echo "$$extras" | sed 's/^/       /' ;                    \
470             fi ;                                                        \
471             echo $(INSTALL_DATA) $$src $$conf ;                         \
472                  $(INSTALL_DATA) $$src $$conf ;                         \
473             echo rm -f $$src ;                                          \
474                  rm -f $$src ;                                          \
475           fi ;                                                          \
476           if ( grep $$dest $$conf >/dev/null ); then                    \
477             echo ;                                                      \
478           else                                                          \
479             e=echo ;                                                    \
480  $$e ""                                                                      ;\
481  $$e "  ####################################################################";\
482  $$e "  Warning: xscreensaver has been compiled with support for Pluggable"  ;\
483  $$e "           Authentication Modules (PAM).  However, we were unable to"  ;\
484  $$e "           install xscreensaver rules in the file $$conf."             ;\
485  $$e "           PAM is unlikely to work without this (and old-style"        ;\
486  $$e "           password authentication will be used instead, which may"    ;\
487  $$e "           or may not work.)"                                          ;\
488  $$e "  ####################################################################";\
489  $$e ""                                                                      ;\
490           fi ;                                                          \
491         fi
492
493 # screensaver-properties.desktop
494 # into /usr/share/applications/
495 install-gnome:: screensaver-properties.desktop
496         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
497            if [ ! -d "$(install_prefix)$(GTK_APPDIR)" ]; then                 \
498              echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)"           ;\
499                   $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)"           ;\
500            fi                                                                ;\
501            name2=xscreensaver-properties.desktop                             ;\
502            echo $(INSTALL_DATA) screensaver-properties.desktop                \
503                   $(install_prefix)$(GTK_APPDIR)/$$name2                     ;\
504                 $(INSTALL_DATA) screensaver-properties.desktop                \
505                   $(install_prefix)$(GTK_APPDIR)/$$name2                     ;\
506          fi
507
508
509 # xscreensaver.xpm
510 # into /usr/share/pixmaps/
511 install-gnome:: $(LOGO)
512         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
513            if [ ! -d "$(install_prefix)$(GTK_ICONDIR)" ]; then                \
514              echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)"          ;\
515                   $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)"          ;\
516            fi                                                                ;\
517            target=xscreensaver.xpm                                           ;\
518            echo $(INSTALL_DATA) $(LOGO)                                       \
519                   $(install_prefix)$(GTK_ICONDIR)/$$target                   ;\
520                 $(INSTALL_DATA) $(LOGO)                                       \
521                   $(install_prefix)$(GTK_ICONDIR)/$$target                   ;\
522         fi
523
524 # ../utils/images/screensaver-*.png
525 # into /usr/share/xscreensaver/glade/
526 install-gnome::
527         @if [ "$(GTK_DATADIR)" != "" ]; then                                 \
528            if [ ! -d "$(install_prefix)$(GTK_GLADEDIR)" ]; then               \
529              echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)"         ;\
530                   $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)"         ;\
531            fi                                                                ;\
532            for target in $(GTK_ICONS) ; do                                    \
533              dest=`echo $$target | sed 's@^.*/@@'`                           ;\
534              echo $(INSTALL_DATA) $$target                                    \
535                   $(install_prefix)$(GTK_GLADEDIR)/$$dest                    ;\
536                   $(INSTALL_DATA) $$target                                    \
537                   $(install_prefix)$(GTK_GLADEDIR)/$$dest                    ;\
538            done                                                              ;\
539         fi
540
541 # xscreensaver-demo.glade2
542 # into /usr/share/xscreensaver/glade/
543 install-gnome:: xscreensaver-demo.glade2
544         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
545           if [ ! -d "$(install_prefix)$(GTK_GLADEDIR)" ]; then                \
546             echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)"          ;\
547                  $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)"          ;\
548           fi                                                                 ;\
549           target=xscreensaver-demo.glade2                                    ;\
550           echo $(INSTALL_DATA) $(srcdir)/$$target                             \
551             $(install_prefix)$(GTK_GLADEDIR)/$$target                        ;\
552           if   $(INSTALL_DATA) $(srcdir)/$$target                             \
553             $(install_prefix)$(GTK_GLADEDIR)/$$target                        ;\
554             then true                                                        ;\
555           else                                                                \
556             e=echo ;                                                          \
557  $$e ""                                                                      ;\
558  $$e "  ####################################################################";\
559  $$e "  Warning: unable to install $$target into"                            ;\
560  $$e "           $(install_prefix)$(GTK_GLADEDIR)/."                         ;\
561  $$e "           Without this file, xscreensaver-demo will not"              ;\
562  $$e "           be able to run properly."                                   ;\
563  $$e "  ####################################################################";\
564  $$e ""                                                                      ;\
565              exit 1 ;                                                         \
566            fi ;                                                               \
567          fi
568
569
570 # screensaver-properties.desktop
571 # into /usr/share/applications/
572 uninstall-gnome::
573         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
574           f=xscreensaver-properties.desktop                                  ;\
575           echo rm -f $(install_prefix)$(GTK_APPDIR)/$$f                      ;\
576                rm -f $(install_prefix)$(GTK_APPDIR)/$$f                      ;\
577         fi
578
579 # xscreensaver.xpm
580 # into /usr/share/pixmaps/
581 uninstall-gnome::
582         @if [ "$(GTK_ICONDIR)" != "" ]; then                                  \
583           target=xscreensaver.xpm                                            ;\
584           echo rm -f $(install_prefix)$(GTK_ICONDIR)/$$target                ;\
585                rm -f $(install_prefix)$(GTK_ICONDIR)/$$target                ;\
586          fi
587
588 # ../utils/images/screensaver-*.png
589 # into /usr/share/xscreensaver/glade/
590 uninstall-gnome::
591         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
592            for target in $(GTK_ICONS) ; do                                    \
593              dest=`echo $$target | sed 's@^.*/@@'`                           ;\
594              echo rm -f $(install_prefix)$(GTK_GLADEDIR)/$$dest              ;\
595                   rm -f $(install_prefix)$(GTK_GLADEDIR)/$$dest              ;\
596            done                                                              ;\
597         fi
598
599 # xscreensaver-demo.glade2
600 # into /usr/share/xscreensaver/glade/
601 uninstall-gnome:: xscreensaver-demo.glade2
602         @if [ "$(GTK_DATADIR)" != "" ]; then                                  \
603           target=xscreensaver-demo.glade2                                    ;\
604           echo rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target               ;\
605                rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target               ;\
606          fi
607
608 # /usr/share/xscreensaver/config/README
609 install-xml:
610         @dest=$(install_prefix)$(HACK_CONF_DIR) ;                       \
611          if [ ! -d $$dest ]; then                                       \
612            $(INSTALL_DIRS) $$dest ;                                     \
613          fi ;                                                           \
614          src=$(srcdir)/../hacks/config ;                                \
615          echo $(INSTALL_DATA) $$src/README $$dest/README ;              \
616               $(INSTALL_DATA) $$src/README $$dest/README
617
618
619 # /usr/share/xscreensaver/config/README
620 uninstall-xml:
621         rm -f $(install_prefix)$(HACK_CONF_DIR)/README
622
623 clean:
624         -rm -f *.o a.out core $(EXES) $(EXES2) $(TEST_EXES) \
625         XScreenSaver_ad.h XScreenSaver_Xm_ad.h
626
627 distclean: clean
628         -rm -f Makefile XScreenSaver.ad \
629         TAGS *~ "#"* screensaver-properties.desktop
630
631 # Adds all current dependencies to Makefile
632 depend: XScreenSaver_ad.h XScreenSaver_Xm_ad.h
633         $(DEPEND) -s '# DO NOT DELETE: updated by make depend'              \
634         $(DEPEND_FLAGS) --                                                  \
635         $(INCLUDES) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) --      \
636         $(SAVER_SRCS) $(CMD_SRCS) $(GETIMG_SRCS_1)
637
638 # Adds some dependencies to Makefile.in -- not totally accurate, but pretty
639 # close.  This excludes dependencies on files in /usr/include, etc.  It tries
640 # to include only dependencies on files which are themselves a part of this
641 # package.
642 distdepend: check_men update_ad_version XScreenSaver_ad.h XScreenSaver_Xm_ad.h
643         @echo updating dependencies in `pwd`/Makefile.in... ;               \
644         $(DEPEND) -w 0 -f -                                                 \
645         -s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \
646         $(INCLUDES) -I$(ICON_SRC) $(DEFS) $(DEPEND_DEFINES)                 \
647         $(CFLAGS) $(X_CFLAGS) --                                            \
648         $(SAVER_SRCS_1) $(MOTIF_SRCS) $(GTK_SRCS) $(GETIMG_SRCS_1)          \
649         $(PWENT_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) $(CMD_SRCS)             \
650         $(TEST_SRCS) 2>/dev/null |                                          \
651         sort -d |                                                           \
652         (                                                                   \
653           awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \
654           sed -e '/^#.*/d'                                                  \
655               -e 's@ \./@ @g;s@ /[^ ]*@@g;/^.*:$$/d'                        \
656               -e 's@\.\./utils@$$(UTILS_SRC)@g'                             \
657               -e 's@ \([^$$]\)@ $$(srcdir)/\1@g'                            \
658               -e 's@$$.*\(XScreenSaver_ad\)@\1@g'                           \
659               -e 's@$$.*\(XScreenSaver_Xm_ad\)@\1@g'                        \
660               -e 's@ $$(srcdir)/\(.*config\.h\)@ \1@g' ;                    \
661           echo ''                                                           \
662         ) > /tmp/distdepend.$$$$ &&                                         \
663         mv Makefile.in Makefile.in.bak &&                                   \
664         mv /tmp/distdepend.$$$$ Makefile.in
665
666 # Updates the version number in the app-defaults file to be in sync with 
667 # the version number in version.h.  This is so people can tell when they
668 # have a version skew between the app-defaults file and the executable.
669 # Also update hacks/config/README in the same way.
670 update_ad_version::
671         @                                                                   \
672   files="XScreenSaver.ad.in ../hacks/config/README ../OSX/bindist.rtf" ;    \
673   U=$(UTILS_SRC)/version.h ;                                                \
674   V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' < $$U` ;               \
675   D=`date '+%d-%b-%Y'` ;                                                    \
676   for S in $$files ; do                                                     \
677     T=/tmp/xs.$$$$ ;                                                        \
678     sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9]*[ab]*[0-9]*\(.*\)/\1$$V\2/"  \
679         -e "s/\([0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9]*\)/$$D/"         \
680       < $$S > $$T ;                                                         \
681     if cmp -s $$S $$T ; then                                                \
682       true ;                                                                \
683     else                                                                    \
684       cat $$T > $$S ;                                                       \
685       echo "updated $$S to $$V $$D" ;                                       \
686     fi ;                                                                    \
687   done ;                                                                    \
688   rm $$T
689
690 TAGS: tags
691 tags:
692         find $(srcdir) -name '*.[chly]' -print | xargs etags -a
693
694 echo_tarfiles:
695         @$(MAKE) XScreenSaver_ad.h XScreenSaver_Xm_ad.h 2>&1 >/dev/null
696         @echo $(TARFILES)
697
698 check_men:
699         @badmen="" ;                                                    \
700          for exe in $(EXES); do                                         \
701            if ! [ -f $(srcdir)/$$exe.man ]; then                        \
702              badmen="$$badmen $$exe" ;                                  \
703            fi ;                                                         \
704          done ;                                                         \
705          if [ -n "$$badmen" ]; then                                     \
706            echo "" ;                                                    \
707            echo "Warning: The following programs have no manuals:" ;    \
708            echo "" ;                                                    \
709            for m in $$badmen ; do                                       \
710              echo "    $$m" ;                                           \
711            done ;                                                       \
712            echo "" ;                                                    \
713          fi
714
715
716 # Rules for noticing when the objects from the utils directory are out of
717 # date with respect to their sources, and going and building them according
718 # to the rules in their own Makefile...
719 #
720 $(UTILS_BIN)/fade.o:            $(UTILS_SRC)/fade.c
721 $(UTILS_BIN)/overlay.o:         $(UTILS_SRC)/overlay.c
722 $(UTILS_BIN)/resources.o:       $(UTILS_SRC)/resources.c
723 $(UTILS_BIN)/usleep.o:          $(UTILS_SRC)/usleep.c
724 $(UTILS_BIN)/visual.o:          $(UTILS_SRC)/visual.c
725 $(UTILS_BIN)/xmu.o:             $(UTILS_SRC)/xmu.c
726 $(UTILS_BIN)/logo.o:            $(UTILS_SRC)/logo.c
727 $(UTILS_BIN)/minixpm.o:         $(UTILS_SRC)/minixpm.c
728 $(UTILS_BIN)/yarandom.o:        $(UTILS_SRC)/yarandom.c
729 $(UTILS_BIN)/colorbars.o:       $(UTILS_SRC)/colorbars.c
730
731 $(SAVER_UTIL_OBJS):
732         cd $(UTILS_BIN) ; \
733         $(MAKE) $(@F) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
734
735 # How we build object files in this directory.
736 .c.o:
737         $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $<
738
739 .m.o:
740         $(OBJCC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $<
741
742 # subprocs takes an extra -D option.
743 subprocs.o: subprocs.c
744         $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CFLAGS) $(X_CFLAGS) \
745           $(srcdir)/subprocs.c
746
747 # demo-Gtk takes extra -D options, and an extra -I option.
748 demo-Gtk.o: demo-Gtk.c
749         $(CC) -c $(INCLUDES) $(SUBP_DEFS) -I$(ICON_SRC) \
750           $(GTK_DEFS) $(INTL_DEFS) $(CFLAGS) $(X_CFLAGS) \
751           $(srcdir)/demo-Gtk.c
752
753 # demo-Gtk-conf takes an extra -D option.
754 demo-Gtk-conf.o: demo-Gtk-conf.c
755         $(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CFLAGS) $(X_CFLAGS) \
756           $(srcdir)/demo-Gtk-conf.c
757
758
759 # How we build the default app-defaults file into the program.
760 #
761 XScreenSaver_ad.h: XScreenSaver.ad
762         $(SHELL) $(UTILS_SRC)/ad2c XScreenSaver.ad > XScreenSaver_ad.h
763
764 XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad
765         $(SHELL) $(UTILS_SRC)/ad2c XScreenSaver-Xm.ad > XScreenSaver_Xm_ad.h
766
767 @INTLTOOL_DESKTOP_RULE@
768
769 # The executables linked in this directory.
770 #
771 xscreensaver: $(SAVER_OBJS)
772         $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS)
773
774 xscreensaver-command: $(CMD_OBJS)
775         $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)
776
777
778 xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@
779         @if [ "@PREFERRED_DEMO_PROGRAM@" = "" ]; then                   \
780           echo "WARNING: neither GTK nor Motif are available,"          \
781                "therefore no xscreensaver-demo!"                      ; \
782           rm -f $@@EXEEXT@                                            ; \
783         else                                                            \
784           echo cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@      ; \
785                cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@      ; \
786         fi
787
788 xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS)
789         $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \
790         $(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
791         $(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS)
792
793 xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS)
794         $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(LIBS) $(X_LIBS) \
795         $(GTK_LIBS) $(XPM_LIBS) $(XML_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) \
796         -lXt -lX11 $(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS)
797
798 demo-Gtk.o: XScreenSaver_ad.h
799 demo-Xm.o:  XScreenSaver_Xm_ad.h
800
801 xscreensaver-getimage: $(GETIMG_OBJS)
802         $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm
803
804 pdf2jpeg: $(PDF2JPEG_OBJS)
805         $(OBJCC) $(LDFLAGS) -o $@ $(PDF2JPEG_OBJS) $(PDF2JPEG_LIBS) -lm
806
807
808 TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \
809          subprocs.o setuid.o splash.o prefs.o mlstring.o exec.o \
810         $(SAVER_UTIL_OBJS)
811 test-passwd.o: XScreenSaver_ad.h
812
813 test-passwd: $(TEST_PASSWD_OBJS) XScreenSaver_ad.h
814         $(CC) $(LDFLAGS) -o $@ $(TEST_PASSWD_OBJS) $(SAVER_LIBS)
815
816 test-uid: test-uid.o
817         $(CC) $(LDFLAGS) -o $@ test-uid.o
818
819 test-xdpms: test-xdpms.o
820         $(CC) $(LDFLAGS) -o $@ test-xdpms.o $(LIBS) $(X_LIBS) $(XDPMS_LIBS) \
821         $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS)
822
823 test-xinerama: test-xinerama.o
824         $(CC) $(LDFLAGS) -o $@ test-xinerama.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \
825         $(X_PRE_LIBS) $(XINERAMA_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS)
826
827 test-vp: test-vp.o
828         $(CC) $(LDFLAGS) -o $@ test-vp.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \
829         $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS)
830
831 test-randr: test-randr.o
832         $(CC) $(LDFLAGS) -o $@ test-randr.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \
833         $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS)
834
835 test-grab: test-grab.o
836         $(CC) $(LDFLAGS) -o $@ test-grab.o $(SAVER_LIBS)
837
838 test-apm: test-apm.o
839         $(CC) $(LDFLAGS) -o $@ test-apm.o $(SAVER_LIBS) -lapm
840
841 test-mlstring.o: mlstring.c
842 test-mlstring: test-mlstring.o
843         $(CC) -DTEST $(LDFLAGS) -o $@ test-mlstring.o $(SAVER_LIBS)
844
845 TEST_FADE_OBJS = test-fade.o $(UTILS_SRC)/fade.o $(DEMO_UTIL_OBJS)
846 test-fade: test-fade.o $(UTILS_BIN)/fade.o
847         $(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(SAVER_LIBS)
848
849 TEST_SCREENS_OBJS = test-screens.o $(DEMO_UTIL_OBJS)
850 test-screens.o: screens.c
851 test-screens: test-screens.o
852         $(CC) $(LDFLAGS) -o $@ $(TEST_SCREENS_OBJS) $(SAVER_LIBS)
853
854
855 xdpyinfo.o: xdpyinfo.c
856         $(CC) -c $(INCLUDES) -DHAVE_GLX $(CFLAGS) $(X_CFLAGS) \
857           $(srcdir)/xdpyinfo.c
858
859 xdpyinfo: xdpyinfo.o
860         $(CC) $(LDFLAGS) -o $@ xdpyinfo.o \
861                 $(LIBS) $(X_LIBS) @GL_LIBS@ \
862                 $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) -lm
863
864
865 ##############################################################################
866 #
867 # DO NOT DELETE: updated by make distdepend
868