summaryrefslogtreecommitdiffstats
path: root/driver/Makefile.in
blob: 4b3c1cbb51d010296feebf0861ff5ca6d9b860d3 (plain) (blame)
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
# driver/Makefile.in --- xscreensaver, Copyright © 1997-2023 Jamie Zawinski.
# the `../configure' script generates `driver/Makefile' from this file.

@SET_MAKE@
.SUFFIXES:
.SUFFIXES: .c .m .o .desktop .desktop.in .service .service.in

srcdir		= @srcdir@
VPATH		= @srcdir@
top_srcdir	= @top_srcdir@
top_builddir	= ..

install_prefix	=
prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@
datarootdir	= @datarootdir@
datadir		= @datadir@
localedir	= @PO_DATADIR@/locale
mandir		= @mandir@
libexecdir	= @libexecdir@
sysconfdir	= @sysconfdir@

# A = suffix for user commands in /usr/bin/
# B = suffix for helper programs in /usr/libexec/xscreensaver/
mansuffixA	= 1
mansuffixB	= 6

GTK_DATADIR	= @GTK_DATADIR@
GTK_APPDIR	= $(GTK_DATADIR)/applications
GTK_ICONDIR	= $(GTK_DATADIR)/pixmaps
GTK_SHAREDIR	= $(GTK_DATADIR)/xscreensaver
UPDATE_ICON_CACHE = gtk-update-icon-cache
GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@

HACKDIR		= @HACKDIR@
HACK_CONF_DIR	= @HACK_CONF_DIR@

CC		= @CC@
CFLAGS		= @CFLAGS@
LDFLAGS		= @LDFLAGS@
DEFS		= @DEFS@

LIBS		= @LIBS@

DEPEND		= @DEPEND@
DEPEND_FLAGS	= @DEPEND_FLAGS@
DEPEND_DEFINES	= @DEPEND_DEFINES@

INSTALL		= @INSTALL@
SUID_FLAGS      = -o root -m 4755
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SETUID	= $(INSTALL_PROGRAM) $(SUID_FLAGS)
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_DIRS	= @INSTALL_DIRS@
HACKDIR		= @HACKDIR@

X_CFLAGS	= @X_CFLAGS@
X_LIBS		= @X_LIBS@
X_PRE_LIBS	= @X_PRE_LIBS@
X_EXTRA_LIBS	= @X_EXTRA_LIBS@
PNG_LIBS	= @PNG_LIBS@
XFT_LIBS	= @XFT_LIBS@

INTLTOOL_MERGE	= @INTLTOOL_MERGE@
INTL_LIBS	= @INTLLIBS@

# Note:
#
# X_LIBS would more properly be called X_LDFLAGS (it contains the -L args.)
# X_PRE_LIBS contains extra libraries you have to link against on some systems,
#         and that must come before -lX11.  (e.g., -lSM and -lICE.)
# X_EXTRA_LIBS contains extra libraries needed by X that aren't a part of X.
#         (e.g., -lsocket, -lnsl, etc.)
#
# I think (but am not totally sure) that LIBS is also really "LDFLAGS".


AD_DIR		= @APPDEFAULTS@

# $(sysconfdir) is either /usr/local/etc or /usr/etc but this must be /etc.
PAM_ROOT	= /etc
PAM_DIR		= $(PAM_ROOT)/pam.d
PAM_CONF	= $(PAM_ROOT)/pam.conf

ICON_SRC        = $(UTILS_SRC)/images
LOGO		= $(ICON_SRC)/logo-512.png

UTILS_SRC	= $(srcdir)/../utils
UTILS_BIN	= ../utils

INCLUDES_1	= -I. -I$(srcdir) -I$(UTILS_SRC) -I..
INCLUDES	= $(INCLUDES_1) @INCLUDES@

LIBS_PRE	= $(LIBS) $(X_LIBS) $(X_PRE_LIBS)
LIBS_POST	= $(X_EXTRA_LIBS)

XDPMS_LIBS	= @XDPMS_LIBS@
XINERAMA_LIBS	= @XINERAMA_LIBS@
XINPUT_LIBS	= -lXi
XML_LIBS	= @XML_LIBS@

DAEMON_DEFS	= -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' -DAD_DIR='"$(AD_DIR)"'
DAEMON_SRCS	= xscreensaver.c blurb.c atoms.c clientmsg.c xinput.c prefs.c
DAEMON_OBJS	= xscreensaver.o blurb.o atoms.o clientmsg.o xinput.o prefs.o \
		  $(UTILS_BIN)/xmu.o
DAEMON_LIBS	= $(LIBS_PRE) $(XINPUT_LIBS) -lX11 $(LIBS_POST)

GFX_DEFS	= -DLOCALEDIR=\"$(localedir)\"
GFX_SRCS	= xscreensaver-gfx.c screens.c windows.c subprocs.c \
		  exec.c prefsw.c dpms.c fade.c exts.c atomswm.c
GFX_OBJS	= xscreensaver-gfx.o screens.o windows.o subprocs.o \
		  exec.o prefsw.o dpms.o fade.o exts.o atomswm.o \
		  prefs.o blurb.o atoms.o clientmsg.o xinput.o \
		  $(UTILS_BIN)/xmu.o \
		  $(UTILS_BIN)/yarandom.o \
		  $(UTILS_BIN)/resources.o \
		  $(UTILS_BIN)/visual.o \
		  $(UTILS_BIN)/usleep.o \
		  $(UTILS_BIN)/font-retry.o \
		  $(UTILS_BIN)/logo.o \
		  $(UTILS_BIN)/minixpm.o \
		  $(UTILS_BIN)/screenshot.o \
		  $(UTILS_BIN)/xft.o \
		  $(UTILS_BIN)/utf8wc.o \
		  $(UTILS_BIN)/xshm.o \
		  $(UTILS_BIN)/aligned_malloc.o
GFX_LIBS	= $(LIBS_PRE) $(XFT_LIBS) $(XDPMS_LIBS) $(XINERAMA_LIBS) \
		  @SAVER_LIBS@ -lXt -lX11 -lXext -lXi $(LIBS_POST) $(INTL_LIBS)

PWENT_SRCS	= passwd-pwent.c
PWENT_OBJS	= passwd-pwent.o

KERBEROS_SRCS	= passwd-kerberos.c
KERBEROS_OBJS	= passwd-kerberos.o

PAM_SRCS	= passwd-pam.c
PAM_OBJS	= passwd-pam.o

PASSWD_SRCS	= @PASSWD_SRCS@
PASSWD_OBJS	= @PASSWD_OBJS@

LOCK_SRCS	= @LOCK_SRCS@
LOCK_OBJS	= @LOCK_OBJS@


AUTH_DEFS	= -DLOCALEDIR=\"$(localedir)\" -DAD_DIR='"$(AD_DIR)"'
AUTH_SRCS	= xscreensaver-auth.c dialog.c passwd.c setuid.c
AUTH_OBJS	= xscreensaver-auth.o $(AUTH_OBJS_1)
AUTH_OBJS_1	= dialog.o passwd.o setuid.o \
		  @PASSWD_OBJS@ \
		  blurb.o screens.o xinput.o prefs.o atoms.o atomswm.o \
		  $(UTILS_BIN)/xft.o \
		  $(UTILS_BIN)/xftwrap.o \
		  $(UTILS_BIN)/utf8wc.o \
		  $(UTILS_BIN)/font-retry.o \
		  $(UTILS_BIN)/yarandom.o \
		  $(UTILS_BIN)/usleep.o \
		  $(UTILS_BIN)/resources.o \
		  $(UTILS_BIN)/logo.o \
		  $(UTILS_BIN)/minixpm.o
AUTH_LIBS	= $(LIBS_PRE) $(XFT_LIBS) $(XINPUT_LIBS) $(XINERAMA_LIBS) \
		  $(XDPMS_LIBS) @SAVER_LIBS@ -lXt -lX11 -lXext -lXi \
		  @PASSWD_LIBS@ $(LIBS_POST) $(INTL_LIBS)

SYSTEMD_DEFS	= 
SYSTEMD_SRCS	= xscreensaver-systemd.c
SYSTEMD_OBJS	= xscreensaver-systemd.o blurb.o $(UTILS_BIN)/yarandom.o
SYSTEMD_LIBS	= $(LIBS_PRE) @SYSTEMD_LIBS@ -lX11 $(LIBS_POST)

CMD_DEFS	= 
CMD_SRCS	= remote.c xscreensaver-command.c
CMD_OBJS	= remote.o xscreensaver-command.o blurb.o atoms.o clientmsg.o
CMD_LIBS	= $(LIBS_PRE) $(XINPUT_LIBS) -lX11 -lXext $(LIBS_POST)

GTK_DEFS	= -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' \
		  -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' \
		  -DLOCALEDIR=\"$(localedir)\" \
		  -I$(ICON_SRC)
GTK_SRCS	= demo-Gtk.c demo-Gtk-conf.c
GTK_OBJS	= demo-Gtk.o demo-Gtk-conf.o demo-Gtk-resources.o \
		  blurb.o exec.o prefs.o prefsw.o dpms.o remote.o screens.o \
		  clientmsg.o atoms.o \
		  $(UTILS_BIN)/xmu.o \
		  $(UTILS_BIN)/resources.o \
		  $(UTILS_BIN)/visual.o \
		  $(UTILS_BIN)/screenshot.o \
		  $(UTILS_BIN)/usleep.o
GTK_LIBS	= $(LIBS_PRE) $(INTL_LIBS) $(XDPMS_LIBS) \
		  $(XINERAMA_LIBS) $(XML_LIBS) @GTK_LIBS@ \
		  -lXt -lX11 -lXext -lXi $(LIBS_POST)

MOTIF_DEFS	= -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' \
		  -DDEFAULT_PATH_PREFIX='"@HACKDIR@"'
MOTIF_SRCS	= demo-Xm.c demo-Xm-widgets.c
MOTIF_OBJS	= demo-Xm.o demo-Xm-widgets.o \
		  blurb.o exec.o prefs.o prefsw.o dpms.o remote.o \
		  clientmsg.o atoms.o \
		  $(UTILS_BIN)/xmu.o \
		  $(UTILS_BIN)/resources.o \
		  $(UTILS_BIN)/visual.o \
		  $(UTILS_BIN)/usleep.o
MOTIF_LIBS	= $(LIBS_PRE) $(XDPMS_LIBS) $(XDPMS_LIBS) @MOTIF_LIBS@ \
		  @PNG_LIBS@ -lXt -lX11 -lXext -lXi $(LIBS_POST)

TEST_SRCS	= test-passwd.c test-uid.c      test-xdpms.c    test-grab.c   \
		  test-fade.c   test-xinerama.c test-vp.c       test-randr.c  \
	          xdpyinfo.c    test-screens.c  test-yarandom.c test-xinput.c \
	          test-xkb.c
TEST_EXES	= test-passwd   test-uid        test-xdpms      test-grab     \
		  test-fade     test-xinerama   test-vp         test-randr    \
		  xdpyinfo      test-screens    test-yarandom   test-xinput   \
	          test-xkb

EXES		= xscreensaver xscreensaver-command xscreensaver-settings
UTIL_EXES	= xscreensaver-gfx @EXES_SYSTEMD@
SETUID_EXES	= xscreensaver-auth
DEMO_EXES	= @ALL_DEMO_PROGRAMS@
EXES_SYSTEMD	= xscreensaver-systemd
DESKS		= xscreensaver.desktop xscreensaver.service

HDRS		= XScreenSaver_ad.h XScreenSaver_Xm_ad.h \
		  xscreensaver.h prefs.h remote.h exec.h \
		  demo-Gtk-conf.h auth.h types.h blurb.h atoms.h clientmsg.h \
		  screens.h xinput.h fade.h
MENA		= xscreensaver.man xscreensaver-settings.man \
		  xscreensaver-command.man
MENB		= xscreensaver-gfx.man xscreensaver-auth.man \
		  xscreensaver-systemd.man

EXTRAS		= README Makefile.in \
		  XScreenSaver.ad.in XScreenSaver-Xm.ad xscreensaver.pam.in \
		  demo.ui prefs.ui gresource.xml xscreensaver.desktop.in \
		  xscreensaver-settings.desktop.in xscreensaver.service.in

TARFILES	= $(DAEMON_SRCS) $(GFX_SRCS) $(AUTH_SRCS) $(SYSTEMD_SRCS) \
		  $(CMD_SRCS) $(GTK_SRCS) $(MOTIF_SRCS) $(PWENT_SRCS) \
		  $(KERBEROS_SRCS) $(PAM_SRCS) \
		  $(HDRS) $(MENA) $(MENB) $(TEST_SRCS) $(EXTRAS) 

# Using $(MAKE) directly means the shell executes things even with "make -n"
MAKE2 = $(MAKE)
MAKE2CC = $(MAKE2) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

default:: $(EXES) $(UTIL_EXES) $(SETUID_EXES) $(DESKS)
all::     default $(DEMO_EXES)
tests::   $(TEST_EXES)

##############################################################################
#
# Installation
#
##############################################################################

install:   install-program   install-ad   install-man   install-xml    \
	   install-pam	install-gnome
uninstall: uninstall-program uninstall-ad uninstall-man uninstall-xml  \
	   uninstall-gnome

install-strip:
	$(MAKE2) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install

install-program:: $(EXES)
	@if [ ! -d $(install_prefix)$(bindir) ]; then			      \
	   $(INSTALL_DIRS) $(install_prefix)$(bindir) ;			      \
	 fi ;								      \
	 if [ ! -d $(install_prefix)$(HACKDIR) ]; then			      \
	   $(INSTALL_DIRS) $(install_prefix)$(HACKDIR) ;		      \
	 fi

install-program:: $(EXES)
	@inst="$(INSTALL_PROGRAM)" ;					      \
	for exe in $(EXES); do						      \
	  echo $$inst $$exe $(install_prefix)$(bindir)/$$exe ;		      \
	       $$inst $$exe $(install_prefix)$(bindir)/$$exe ;		      \
	done

install-program:: $(UTIL_EXES)
	@inst="$(INSTALL_PROGRAM)" ;					      \
	 for exe in $(UTIL_EXES); do					      \
	    echo $$inst $$exe $(install_prefix)$(HACKDIR)/$$exe ;	      \
	         $$inst $$exe $(install_prefix)$(HACKDIR)/$$exe ;	      \
	 done

install-program:: $(SETUID_EXES)
	@inst="$(INSTALL_PROGRAM)" ;					      \
	 idir="$(install_prefix)$(HACKDIR)" ;				      \
	 if [ @SETUID_AUTH@ = yes ]; then				      \
	   inst="$(INSTALL_SETUID)" ;					      \
	 else								      \
	   inst="$(INSTALL_PROGRAM)" ;					      \
	 fi ;								      \
	 for exe in $(SETUID_EXES); do					      \
	   echo $$inst $$exe $$idir/$$exe ;				      \
	   if   $$inst $$exe $$idir/$$exe ; then			      \
	     true ;							      \
	   elif [ @SETUID_AUTH@ = yes ]; then				      \
	     echo $(INSTALL_PROGRAM) $$exe $$idir/$$exe ;		      \
	     if   $(INSTALL_PROGRAM) $$exe $$idir/$$exe ; then		      \
	       echo "" ;						      \
	       echo "WARNING: unable to install $$exe setuid." ;	      \
	       echo "WARNING: authentication may not work!" ;		      \
	       echo "" ;						      \
	     else							      \
	       exit 1 ;							      \
	     fi ;							      \
	   else								      \
	     exit 1 ;							      \
	   fi ;								      \
	 done


# Symlink from xscreensaver-demo -> xscreensaver-settings in /usr/bin/
install-program::
	@D=$(install_prefix)$(bindir) ;					      \
	 echo ln -sf xscreensaver-settings $$D/xscreensaver-demo ; 	      \
	      ln -sf xscreensaver-settings $$D/xscreensaver-demo

install-ad: XScreenSaver.ad
	@if [ ! -d $(install_prefix)$(AD_DIR) ]; then			      \
	  $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ;			      \
	 fi ;								      \
	echo $(INSTALL_DATA) XScreenSaver.ad				      \
	  $(install_prefix)$(AD_DIR)/XScreenSaver ;			      \
	if $(INSTALL_DATA) XScreenSaver.ad				      \
	  $(install_prefix)$(AD_DIR)/XScreenSaver ; then		      \
	  true ;							      \
	else								      \
	  e=echo ;							      \
	  if [ -f $(install_prefix)$(AD_DIR)/XScreenSaver ]; then	      \
 $$e ""									     ;\
 $$e "  ####################################################################";\
 $$e "  Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver"  ;\
 $$e "           That file exists, and is unwritable.  It is probably from"  ;\
 $$e "           an older version of xscreensaver, and could cause things"   ;\
 $$e "           to malfunction.  Please delete it!"			     ;\
 $$e "  ####################################################################";\
 $$e ""									     ;\
	    exit 1 ;							      \
	  else								      \
 $$e ""									     ;\
 $$e "  ####################################################################";\
 $$e "  Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver"  ;\
 $$e "           This is probably ok; it should work without that file."     ;\
 $$e "  ####################################################################";\
 $$e ""									     ;\
	    exit 0 ;							      \
	  fi								      \
	fi

# When installing man pages, we install "foo.man" as "foo.N" and update
# the .TH line in the installed file with one like
#
#     .TH XScreenSaver N "V.VV (DD-MMM-YYYY)" "X Version 11"
#
# where N is the manual section suffix (usually 1 or 6, depending).
#
install-man:: $(MENA) $(MENB)
	@								\
	U=$(UTILS_SRC)/version.h ;					\
	V=`sed -n 's/.*xscreensaver \([0-9]\.[^)]*)\).*/\1/p' < $$U |	\
	    head -1` ;							\
	T=/tmp/xs$$$$.man ;						\
	SUFA=$(mansuffixA) ;						\
	SUFB=$(mansuffixB) ;						\
									\
	INST() {							\
	  TH=".TH XScreenSaver $$SUF \"$$V\" \"X Version 11\"" ;	\
	  DIR="$(install_prefix)$(mandir)/man$$SUF" ;			\
	  if [ ! -d $$DIR ]; then					\
	    echo $(INSTALL_DIRS) $$DIR ;				\
	         $(INSTALL_DIRS) $$DIR ;				\
	   fi ;								\
									\
	  sed -e "s/^\.TH.*/$$TH/"					\
	      -e "s/^\(\.BR xscreens[^ ]* (\)[0-9]\(.*\)/\1$$SUFA\2/"	\
	      -e "s@(MANSUFFIX)@($$SUFB)@g"				\
	    < $(srcdir)/$$man > $$T ;					\
	  manbase=`echo $$man | sed 's/\.man$$//'` ;			\
	  echo $(INSTALL_DATA) $$man $$DIR/$$manbase.$$SUF ;		\
	       $(INSTALL_DATA) $$T   $$DIR/$$manbase.$$SUF ;		\
	} ;								\
									\
	SUF=$$SUFA ; for man in $(MENA); do INST ; done ;		\
	SUF=$$SUFB ; for man in $(MENB); do INST ; done ;		\
	rm -f $$T

# Symlink from xscreensaver-demo.1 -> xscreensaver-settings.1 in /usr/man/man1/
install-man::
	@D=$(install_prefix)$(mandir)/man$(mansuffixA) ;		\
	 F1=xscreensaver-settings.$(mansuffixA) ;			\
	 F2=xscreensaver-demo.$(mansuffixA) ;				\
	 echo ln -sf $$F1 $$D/$$F2 ;					\
	      ln -sf $$F1 $$D/$$F2

# These used to be in driver/ and installed into /usr/bin/
# Now they are in hacks/ and are installed into /usr/libexec/xscreensaver/
OLD_EXES = xscreensaver-getimage xscreensaver-getimage-file \
	   xscreensaver-getimage-video xscreensaver-text \
	   xscreensaver-systemd
OLD_MEN  = xscreensaver-getimage.man xscreensaver-getimage-file.man \
	   xscreensaver-getimage-video.man xscreensaver-text.man \
	   xscreensaver-demo.man
uninstall-program::
	@for program in $(EXES) $(OLD_EXES); do				\
	  echo rm -f $(install_prefix)$(bindir)/$$program ;		\
	  rm -f $(install_prefix)$(bindir)/$$program ;			\
	done

uninstall-program::
	@for program in $(UTIL_EXES) $(SETUID_EXES); do			\
	  echo rm -f $(install_prefix)$(HACKDIR)/$$program ;		\
	       rm -f $(install_prefix)$(HACKDIR)/$$program ;		\
	done

uninstall-ad:
	rm -f $(install_prefix)$(AD_DIR)/XScreenSaver

uninstall-man:
	@men="$(MEN) $(OLD_MEN)" ;					\
	for man in $$men; do						\
	  instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ;	\
	  echo rm -f $(install_prefix)$(manAdir)/$$instname* ;		\
	       rm -f $(install_prefix)$(manAdir)/$$instname* ;		\
	done

install-pam: xscreensaver.pam
	@src="xscreensaver.pam" ;					\
	name=`sed -n 's/.*PAM_SERVICE_NAME[ 	]*"\([^"]*\)".*$$/\1/p'	\
	   < ../config.h` ;						\
	dir="$(install_prefix)$(PAM_DIR)" ;				\
	conf="$(PAM_CONF)" ;						\
									\
	if [ -z "$$name" ]; then					\
	  echo "PAM not configured, not installing" >&2 ;		\
	  exit 0 ;							\
	fi ;								\
									\
	if [ ! -d $(install_prefix)$(PAM_ROOT) ]; then			\
	  echo $(INSTALL_DIRS) $(install_prefix)$(PAM_ROOT) ;		\
	       $(INSTALL_DIRS) $(install_prefix)$(PAM_ROOT) ;		\
	fi ;								\
									\
	if [ -d $$dir ] ; then						\
									\
	  if [ -f $$dir/xdm ]; then					\
	    src2=$$dir/xdm ;						\
	  elif [ -f $$dir/login ]; then					\
	    src2=$$dir/login ;						\
	  fi ;								\
									\
	  if [ -z "$$src2" ]; then					\
	    echo $(INSTALL_DATA) $$src $$dir/$$name ;			\
	         $(INSTALL_DATA) $$src $$dir/$$name ;			\
	  else								\
	    tmp="xscreensaver.pam.$$$$" ;				\
	    grep '^#%\|^auth\|^@include' $$src2 > $$tmp ;		\
	    if cmp -s $$tmp $$dir/$$name ; then				\
	      echo "$$dir/$$name unchanged" ;				\
	    else							\
	      echo "Updating contents of $$dir/$$name from $$src2" ;	\
	      $(INSTALL_DATA) $$tmp $$dir/$$name ;			\
	    fi ;							\
	    rm -f $$tmp ;						\
	  fi ;								\
									\
	  if [ ! -f $$dir/$$name ]; then				\
	    e=echo ;							\
 $$e ""									     ;\
 $$e "  ####################################################################";\
 $$e "  Warning: xscreensaver has been compiled with support for Pluggable"  ;\
 $$e "           Authentication Modules (PAM).  However, we were unable to"  ;\
 $$e "           install the file \"$$dir/$$name\".  XScreenSaver is"        ;\
 $$e "           unlikely to work without this file."			     ;\
 $$e "  ####################################################################";\
 $$e ""									     ;\
	  fi ;								\
	elif [ -f $$conf -a "x$$name" != "x" ]; then			\
	  if ( grep $$name $$conf >/dev/null ); then			\
	   echo "$$conf unchanged: already has an entry for $$name" ;   \
	  else								\
	    tmp="pam.conf.$$$$" ;					\
	    grep -v $$name $$conf > $$tmp ;				\
	    extras=`sed -n "s/^login\(.*auth.*\)$$/$$name\1/p" $$conf`; \
	    echo "$$extras" >> $$tmp ;					\
	    if [ "x$$extras" = "x" ]; then				\
	      echo "Error: no login rules in $$conf?" >&2 ;		\
	    else							\
	      echo "adding $$name rules to $$conf:" ;			\
	      echo "" ;							\
	      echo "$$extras" | sed 's/^/	/' ;			\
	    fi ; 							\
	    $(INSTALL_DATA) $$tmp $$conf ;				\
	    rm -f $$tmp ;						\
	  fi ;								\
	  if ( grep $$name $$conf >/dev/null ); then			\
	    echo ;							\
	  else								\
	    e=echo ;							\
 $$e ""									     ;\
 $$e "  ####################################################################";\
 $$e "  Warning: xscreensaver has been compiled with support for Pluggable"  ;\
 $$e "           Authentication Modules (PAM).  However, we were unable to"  ;\
 $$e "           install xscreensaver rules in the file $$conf."	     ;\
 $$e "           XScreenSaver is unlikely to work without this."	     ;\
 $$e "  ####################################################################";\
 $$e ""									     ;\
	  fi ;								\
	else								\
	    e=echo ;							\
 $$e ""									     ;\
 $$e "  ####################################################################";\
 $$e "  Warning: $$dir/ does not exist, not installing PAM config."          ;\
 $$e "  ####################################################################";\
 $$e ""									     ;\
	fi


# xscreensaver.desktop
# xscreensaver-settings.desktop
# into /usr/share/applications/
install-gnome:: xscreensaver.desktop xscreensaver-settings.desktop
	@if [ "$(GTK_DATADIR)" != "" ]; then				      \
	   if [ ! -d "$(install_prefix)$(GTK_APPDIR)" ]; then		      \
	     echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)"	     ;\
		  $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)"	     ;\
	   fi								     ;\
	   old=xscreensaver-properties.desktop				     ;\
	   if [ -f "$(install_prefix)$(GTK_APPDIR)/$$old" ]; then	      \
	     echo rm -f "$(install_prefix)$(GTK_APPDIR)/$$old"		     ;\
		  rm -f "$(install_prefix)$(GTK_APPDIR)/$$old"		     ;\
	   fi								     ;\
	   for name in xscreensaver.desktop xscreensaver-settings.desktop ; do\
	    echo $(INSTALL_DATA) $$name $(install_prefix)$(GTK_APPDIR)/$$name;\
		 $(INSTALL_DATA) $$name $(install_prefix)$(GTK_APPDIR)/$$name;\
	    echo chmod a+x $(install_prefix)$(GTK_APPDIR)/$$name	     ;\
		 chmod a+x $(install_prefix)$(GTK_APPDIR)/$$name	     ;\
	   done								     ;\
	 fi

# xscreensaver.service
# into /usr/share/xscreensaver/
# But maybe it should instead be installed as:
# $(prefix)/share/dbus-1/system-services/org.jwz.xscreensaver.service
# Or would that make it be enabled by default?
#
install-gnome:: xscreensaver.service
	@if [ ! -d "$(install_prefix)$(GTK_SHAREDIR)" ]; then		      \
	   echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_SHAREDIR)"	     ;\
		$(INSTALL_DIRS) "$(install_prefix)$(GTK_SHAREDIR)"	     ;\
	 fi								     ;\
	 name=xscreensaver.service					     ;\
	 echo $(INSTALL_DATA) $$name $(install_prefix)$(GTK_SHAREDIR)/$$name ;\
	      $(INSTALL_DATA) $$name $(install_prefix)$(GTK_SHAREDIR)/$$name

# xscreensaver.png
# into /usr/share/pixmaps/
install-gnome:: $(LOGO)
	@if [ "$(GTK_DATADIR)" != "" ]; then                                  \
           if [ ! -d "$(install_prefix)$(GTK_ICONDIR)" ]; then                \
             echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)"          ;\
                  $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)"          ;\
           fi                                                                ;\
	   target=xscreensaver.png                                           ;\
	   echo $(INSTALL_DATA) $(LOGO)					      \
	          $(install_prefix)$(GTK_ICONDIR)/$$target		     ;\
	        $(INSTALL_DATA) $(LOGO)					      \
	          $(install_prefix)$(GTK_ICONDIR)/$$target		     ;\
        fi

install-gnome:: uninstall-old-gnome-icons
install-gnome:: update-icon-caches

update-icon-caches::
	@for f in /usr/share/icons/index.theme				      \
		  /usr/share/icons/*/index.theme			      \
		  /usr/share/pixmaps/index.theme			      \
		  /usr/share/pixmaps/*/index.theme			      \
	 ; do								      \
	   if [ -f $$f ]; then						      \
	     f=`dirname $$f`						     ;\
	     echo $(UPDATE_ICON_CACHE) --force --quiet $$f		     ;\
	          $(UPDATE_ICON_CACHE) --force --quiet $$f		     ;\
	   fi								     ;\
	 done

# xscreensaver.desktop
# xscreensaver-settings.desktop
# into /usr/share/applications/
uninstall-gnome::
	@if [ "$(GTK_DATADIR)" != "" ]; then				      \
	  old=xscreensaver-properties.desktop				     ;\
	  if [ -f "$old" ]; then					      \
	    echo rm -f $(install_prefix)$(GTK_APPDIR)/$$old		     ;\
		 rm -f $(install_prefix)$(GTK_APPDIR)/$$old		     ;\
	  fi								     ;\
	  for f in xscreensaver.desktop xscreensaver-settings.desktop; do     \
	    echo rm -f $(install_prefix)$(GTK_APPDIR)/$$f		     ;\
	         rm -f $(install_prefix)$(GTK_APPDIR)/$$f		     ;\
	  done								     ;\
	fi

# xscreensaver.xpm (pre-2022)
# from /usr/share/pixmaps/
uninstall-gnome::
	@if [ "$(GTK_ICONDIR)" != "" ]; then				      \
	  target=xscreensaver.xpm                                            ;\
	  echo rm -f $(install_prefix)$(GTK_ICONDIR)/$$target                ;\
	       rm -f $(install_prefix)$(GTK_ICONDIR)/$$target                ;\
	 fi

# /usr/share/xscreensaver/ui/*.png and *.ui no longer used as of 2022, 6.05.
uninstall-gnome::
	@if [ "$(GTK_ICONDIR)" != "" ]; then				      \
	  echo rm -rf $(install_prefix)$(GTK_SHAREDIR)/ui		     ;\
	       rm -rf $(install_prefix)$(GTK_SHAREDIR)/ui		     ;\
	 fi

# What is all this crap with the wrong logo?
# /usr/share/icons/nuoveXT2/16x16/apps/xscreensaver.png through
# /usr/share/icons/gnome-colors-common/32x32/apps/xscreensaver.png
uninstall-gnome:: uninstall-old-gnome-icons
uninstall-old-gnome-icons::
	@for f in							      \
	   "$(install_prefix)$(GTK_DATADIR)/icons"/*/*/apps/xscreensaver.png  \
	   "$(install_prefix)$(GTK_DATADIR)/icons"/*/*/apps/xscreensaver.svg  \
	   "$(install_prefix)$(GTK_ICONDIR)/xscreensaver.xpm"		      \
	   "$(install_prefix)$(GTK_ICONDIR)/xscreensaver.svg"		     ;\
	 do								      \
	   if [ -f "$$f" ]; then					      \
	     echo rm -f "$$f"						     ;\
		  rm -f "$$f"						     ;\
	   fi								     ;\
	 done

# /usr/share/xscreensaver/glade/ no longer used as of 2022.
uninstall-gnome::
	-rm -rf $(GTK_DATADIR)/xscreensaver/glade


# /usr/share/xscreensaver/config/README
install-xml:
	@dest=$(install_prefix)$(HACK_CONF_DIR) ;			\
	 if [ ! -d $$dest ]; then					\
	   $(INSTALL_DIRS) $$dest ;					\
	 fi ;								\
	 src=$(srcdir)/../hacks/config ;				\
	 echo $(INSTALL_DATA) $$src/README $$dest/README ;		\
	      $(INSTALL_DATA) $$src/README $$dest/README


# /usr/share/xscreensaver/config/README
uninstall-xml:
	rm -f $(install_prefix)$(HACK_CONF_DIR)/README


##############################################################################
#
# Clean and dependencies
#
##############################################################################

clean:
	-rm -f *.o a.out core $(EXES) $(UTIL_EXES) $(SETUID_EXES) \
	$(DEMO_EXES) $(TEST_EXES) \
	XScreenSaver_ad.h XScreenSaver_Xm_ad.h

distclean: clean
	-rm -f \
	TAGS *~ "#"* *.rej *.orig \
	Makefile \
	XScreenSaver.ad \
	xscreensaver.pam

# Adds all current dependencies to Makefile
depend: XScreenSaver_ad.h XScreenSaver_Xm_ad.h
	$(DEPEND) -s '# DO NOT DELETE: updated by make depend'		    \
	$(DEPEND_FLAGS) --						    \
	$(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) --    \
	$(SAVER_SRCS) $(CMD_SRCS)

# Adds some dependencies to Makefile.in -- not totally accurate, but pretty
# close.  This excludes dependencies on files in /usr/include, etc.  It tries
# to include only dependencies on files which are themselves a part of this
# package.
distdepend: check_men update_ad_version XScreenSaver_ad.h XScreenSaver_Xm_ad.h
	@echo updating dependencies in `pwd`/Makefile.in... ;		    \
	$(DEPEND) -w 0 -f - 						    \
	-s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \
	$(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) --    \
	$(SAVER_SRCS_1) $(SYSTEMD_SRCS) $(MOTIF_SRCS) $(GTK_SRCS)	    \
	$(PWENT_SRCS) $(KERBEROS_SRCS) $(PAM_SRCS)			    \
	$(LOCK_SRCS_1) $(DEMO_SRCS_1) $(CMD_SRCS)			    \
	$(TEST_SRCS) 2>/dev/null |					    \
	sort -d |							    \
	(								    \
	  awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \
	  sed -e '/^#.*/d'						    \
	      -e 's@ \./@ @g;s@ /[^ ]*@@g;/^.*:$$/d'			    \
	      -e 's@\.\./utils@$$(UTILS_SRC)@g'				    \
	      -e 's@ \([^$$]\)@ $$(srcdir)/\1@g'			    \
	      -e 's@$$.*\(XScreenSaver_ad\)@\1@g'			    \
	      -e 's@$$.*\(XScreenSaver_Xm_ad\)@\1@g'			    \
	      -e 's@ $$(srcdir)/\(.*config\.h\)@ \1@g' ;		    \
	  echo ''							    \
	) > /tmp/distdepend.$$$$ &&					    \
	mv /tmp/distdepend.$$$$ Makefile.in

# Updates the version number in the app-defaults file to be in sync with 
# the version number in version.h.  This is so people can tell when they
# have a version skew between the app-defaults file and the executable.
# Also update hacks/config/README in the same way.
update_ad_version::
	@								    \
  files="XScreenSaver.ad.in ../hacks/config/README ../OSX/bindist.rtf" ;    \
  U=$(UTILS_SRC)/version.h ;						    \
  V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^ ]*\).*/\1/p' < $$U | head -1` ;	    \
  Y=`date '+%Y'` ;							    \
  D=`date '+%d-%b-%Y'` ;						    \
  for S in $$files ; do							    \
    T=/tmp/xs.$$$$ ;							    \
    sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9.]*[ab]*[0-9]*\(.*\)/\1$$V\2/" \
        -e "s/\([0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9]*\)/$$D/"	    \
        -e "s/\( [0-9][0-9][0-9][0-9]-\)[0-9][0-9][0-9][0-9] /\1$$Y /"	    \
      < $$S > $$T ;							    \
    if cmp -s $$S $$T ; then						    \
      true ;								    \
    else								    \
      cat $$T > $$S ;							    \
      echo "updated $$S to $$V $$D" ;					    \
    fi ;								    \
  done ;								    \
  rm $$T

TAGS: tags
tags:
	find $(srcdir) -name '*.[chly]' -print | xargs etags -a

list_tarfiles:
	@$(MAKE2) XScreenSaver_ad.h XScreenSaver_Xm_ad.h 2>&1 >/dev/null
	@find $(TARFILES) -type f -print | sort

check_men:
	@badmen="" ;							\
	 for exe in $(EXES); do						\
	   if ! [ -f $(srcdir)/$$exe.man ]; then			\
	     badmen="$$badmen $$exe" ;					\
	   fi ;								\
	 done ;								\
	 if [ -n "$$badmen" ]; then					\
	   echo "" ;							\
	   echo "Warning: The following programs have no manuals:" ;	\
	   echo "" ;							\
	   for m in $$badmen ; do					\
	     echo "    $$m" ;						\
	   done ;							\
	   echo "" ;							\
	 fi


##############################################################################
#
# Dependencies on utils/
#
##############################################################################

$(UTILS_BIN)/overlay.o:		$(UTILS_SRC)/overlay.c
$(UTILS_BIN)/resources.o:	$(UTILS_SRC)/resources.c
$(UTILS_BIN)/usleep.o:		$(UTILS_SRC)/usleep.c
$(UTILS_BIN)/visual.o:		$(UTILS_SRC)/visual.c
$(UTILS_BIN)/xmu.o:		$(UTILS_SRC)/xmu.c
$(UTILS_BIN)/logo.o:		$(UTILS_SRC)/logo.c
$(UTILS_BIN)/minixpm.o:		$(UTILS_SRC)/minixpm.c
$(UTILS_BIN)/yarandom.o:	$(UTILS_SRC)/yarandom.c
$(UTILS_BIN)/colorbars.o:	$(UTILS_SRC)/colorbars.c
$(UTILS_BIN)/hsv.o:		$(UTILS_SRC)/hsv.c
$(UTILS_BIN)/colors.o:		$(UTILS_SRC)/colors.c
$(UTILS_BIN)/grabclient.o:	$(UTILS_SRC)/grabclient.c
$(UTILS_BIN)/utf8wc.o:		$(UTILS_SRC)/utf8wc.c
$(UTILS_BIN)/xftwrap.o:		$(UTILS_SRC)/xftwrap.c
$(UTILS_BIN)/font-retry.o:	$(UTILS_SRC)/font-retry.c
$(UTILS_BIN)/xshm.o:		$(UTILS_SRC)/xshm.c
$(UTILS_BIN)/aligned_malloc.o:	$(UTILS_SRC)/aligned_malloc.c


UTIL_OBJS	= $(UTILS_BIN)/overlay.o \
		  $(UTILS_BIN)/resources.o \
		  $(UTILS_BIN)/usleep.o \
		  $(UTILS_BIN)/visual.o \
		  $(UTILS_BIN)/xmu.o \
		  $(UTILS_BIN)/logo.o \
		  $(UTILS_BIN)/minixpm.o \
		  $(UTILS_BIN)/yarandom.o \
		  $(UTILS_BIN)/colorbars.o \
		  $(UTILS_BIN)/hsv.o \
		  $(UTILS_BIN)/colors.o \
		  $(UTILS_BIN)/grabclient.o \
		  $(UTILS_BIN)/xft.o \
		  $(UTILS_BIN)/xftwrap.o \
		  $(UTILS_BIN)/utf8wc.o \
		  $(UTILS_BIN)/font-retry.o \
		  $(UTILS_BIN)/xshm.o \
		  $(UTILS_BIN)/aligned_malloc.o

$(UTIL_OBJS):
	$(MAKE2CC) -C $(UTILS_BIN) $(@F)


##############################################################################
#
# Compiling the daemon: xscreensaver, xscreensaver-gfx, xscreensaver-auth,
# xscreensaver-systemd and xscreensaver-comand.
#
##############################################################################

# How we build object files in this directory.
CC_ALL=$(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS)
.c.o:
	$(CC) -c $(CC_ALL) $<

# # subprocs takes an extra -D option.
# subprocs.o: subprocs.c
# 	$(CC) -c $(CC_ALL) $(SUBP_DEFS) $<

# xscreensaver takes an extra -D option.
xscreensaver.o: xscreensaver.c
	$(CC) -c $(CC_ALL) $(DAEMON_DEFS) $<

xscreensaver-auth.o: XScreenSaver_ad.h
xscreensaver-auth.o: xscreensaver-auth.c
	$(CC) -c $(CC_ALL) $(AUTH_DEFS) $<

xscreensaver: $(DAEMON_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(DAEMON_OBJS) $(DAEMON_LIBS)

xscreensaver-gfx.o: XScreenSaver_ad.h
xscreensaver-gfx.o: xscreensaver-gfx.c
	$(CC) -c $(CC_ALL) $(GFX_DEFS) $<
xscreensaver-gfx: $(GFX_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(GFX_OBJS) $(GFX_LIBS)

dialog.o: dialog.c
	$(CC) -c $(CC_ALL) $(AUTH_DEFS) $<
xscreensaver-auth: $(AUTH_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(AUTH_OBJS) $(AUTH_LIBS)

xscreensaver-systemd: $(SYSTEMD_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(SYSTEMD_OBJS) $(SYSTEMD_LIBS) -lm

xscreensaver-command: $(CMD_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)


##############################################################################
#
# Compiling the GUI, xscreensaver-settings
#
##############################################################################

demo-Gtk.o: XScreenSaver_ad.h
demo-Gtk.o: demo-Gtk.c
	$(CC) -c $(CC_ALL) $(GTK_DEFS) $<
demo-Gtk-conf.o: demo-Gtk-conf.c
	$(CC) -c $(CC_ALL) $(GTK_DEFS) $<

GCRARGS = --sourcedir=$(srcdir) --sourcedir=$(ICON_SRC) --generate-source
demo-Gtk-resources.c: gresource.xml demo.ui prefs.ui
	$(GLIB_COMPILE_RESOURCES) $(srcdir)/gresource.xml --target=$@ $(GCRARGS)

GTK_WARNINGS = -Wno-long-long -Wno-c99-extensions -Wno-pedantic
demo-Gtk-resources.o: demo-Gtk-resources.c
	$(CC) -c $(CC_ALL) $(GTK_DEFS) $(GTK_WARNINGS) $<

xscreensaver-settings-Gtk: $(GTK_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(GTK_OBJS) $(GTK_LIBS)


demo-Xm.o: XScreenSaver_ad.h
demo-Xm.o: demo-Xm.c
	$(CC) -c $(CC_ALL) $(GTK_DEFS) $<
demo-Xm-widgets.o: demo-Xm-widgets.c
	$(CC) -c $(CC_ALL) $(GTK_DEFS) $<

xscreensaver-settings-Xm: $(MOTIF_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(MOTIF_OBJS) $(MOTIF_LIBS)

xscreensaver-settings: @PREFERRED_DEMO_PROGRAM@
	@if [ "@PREFERRED_DEMO_PROGRAM@" = "" ]; then			\
	  echo "WARNING: neither GTK nor Motif are available,"		\
	       "therefore no xscreensaver-settings!"		      ; \
	  rm -f $@@EXEEXT@					      ;	\
	else								\
	  echo cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@      ;	\
	       cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@      ;	\
	fi


# How we build the default app-defaults file into the program.
#
XScreenSaver_ad.h::
	@TMP=/tmp/xs$$$$.h ;						\
	IN="XScreenSaver.ad" ;						\
	OUT=XScreenSaver_ad.h ;						\
	$(UTILS_SRC)/ad2c $$IN > $$TMP ;				\
	if cmp -s $$TMP $$OUT ; then					\
	  rm -f "$$TMP" ;						\
	else								\
	  echo $(UTILS_SRC)/ad2c $$IN \> $$OUT ;			\
	  mv $$TMP $$OUT ;						\
	fi

XScreenSaver_Xm_ad.h::
	@TMP=/tmp/xs$$$$.h ;						\
	IN="XScreenSaver-Xm.ad" ;					\
	OUT=XScreenSaver_Xm_ad.h ;					\
	$(UTILS_SRC)/ad2c $$IN > $$TMP ;				\
	if cmp -s $$TMP $$OUT ; then					\
	  rm -f "$$TMP" ;						\
	else								\
	  echo $(UTILS_SRC)/ad2c $$IN \> $$OUT ;			\
	  mv $$TMP $$OUT ;						\
	fi

@INTLTOOL_DESKTOP_RULE@
@INTLTOOL_SERVICE_RULE@


##############################################################################
#
# Debugging utilities, not built by default
#
##############################################################################

TESTPASS_OBJS = test-passwd.o test-passwd-b.o $(AUTH_OBJS_1)
TESTPATH_DEFS = -Dxscreensaver_auth_conv=test_auth_conv $(AUTH_DEFS)
test-passwd-b.o: XScreenSaver_ad.h
test-passwd-b.o: $(srcdir)/xscreensaver-auth.c
	$(CC) -c $(CC_ALL) $(TESTPATH_DEFS) $< -o $@
test-passwd: $(TESTPASS_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(TESTPASS_OBJS) $(AUTH_LIBS)

test-uid: test-uid.o
	$(CC) $(LDFLAGS) -o $@ test-uid.o

TESTDPMS_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXt -lX11 -lXext $(LIBS_POST)
test-xdpms: test-xdpms.o blurb.o
	$(CC) $(LDFLAGS) -o $@ test-xdpms.o blurb.o $(TESTDPMS_LIBS)

TESTXINPUT_OBJS = test-xinput.o blurb.o xinput.o
TESTXINPUT_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST)
test-xinput: $(TESTXINPUT_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(TESTXINPUT_OBJS) $(TESTXINPUT_LIBS)

TESTXIN_LIBS = $(LIBS_PRE) $(XINERAMA_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST)
test-xinerama: test-xinerama.o blurb.o
	$(CC) $(LDFLAGS) -o $@ test-xinerama.o blurb.o $(TESTXIN_LIBS)

TESTXKB_OBJS = test-xkb.o blurb.o
TESTXKB_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST)
test-xkb: $(TESTXKB_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(TESTXKB_OBJS) $(TESTXKB_LIBS)

test-vp: test-vp.o blurb.o
	$(CC) $(LDFLAGS) -o $@ test-vp.o blurb.o $(GFX_LIBS)

test-randr: test-randr.o blurb.o
	$(CC) $(LDFLAGS) -o $@ test-randr.o blurb.o $(GFX_LIBS)

TESTGRAB_LIBS = $(LIBS_PRE) -lXt -lX11 -lXext $(LIBS_POST)
test-grab: test-grab.o blurb.o
	$(CC) $(LDFLAGS) -o $@ test-grab.o blurb.o $(TESTGRAB_LIBS)

TEST_FADE_OBJS = test-fade.o fade.o blurb.o atoms.o clientmsg.o xinput.o \
	$(UTILS_BIN)/visual.o $(UTILS_BIN)/resources.o $(UTILS_BIN)/usleep.o \
	$(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o $(UTILS_BIN)/xshm.o \
	$(UTILS_BIN)/xmu.o $(UTILS_BIN)/aligned_malloc.o
test-fade: $(TEST_FADE_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(GFX_LIBS)

TEST_SCREENS_OBJS = test-screens.o screens.o blurb.o
test-screens: $(TEST_SCREENS_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(TEST_SCREENS_OBJS) $(GFX_LIBS)

test-yarandom: test-yarandom.o blurb.o
	$(CC) -DTEST $(LDFLAGS) -o $@ test-yarandom.o blurb.o $(UTILS_BIN)/yarandom.o


XDPY_DEFS = -DHAVE_GLX $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS)
XDPY_LIBS = $(LIBS_PRE) -lGL -lX11 -lXext $(LIBS_POST)
xdpyinfo.o: xdpyinfo.c
	$(CC) -c $(INCLUDES) $(XDPY_DEFS) $(srcdir)/xdpyinfo.c
xdpyinfo: xdpyinfo.o
	$(CC) $(LDFLAGS) -o $@ xdpyinfo.o $(XDPY_LIBS)

##############################################################################
#
# DO NOT DELETE: updated by make distdepend

demo-Gtk-conf.o: $(srcdir)/blurb.h
demo-Gtk-conf.o: ../config.h
demo-Gtk-conf.o: $(srcdir)/demo-Gtk-conf.h
demo-Gtk-conf.o: $(UTILS_SRC)/xscreensaver-intl.h
demo-Gtk.o: XScreenSaver_ad.h
demo-Gtk.o: $(srcdir)/atoms.h
demo-Gtk.o: $(srcdir)/blurb.h
demo-Gtk.o: ../config.h
demo-Gtk.o: $(srcdir)/demo-Gtk-conf.h
demo-Gtk.o: $(srcdir)/remote.h
demo-Gtk.o: $(srcdir)/screens.h
demo-Gtk.o: $(srcdir)/types.h
demo-Gtk.o: $(UTILS_SRC)/resources.h
demo-Gtk.o: $(UTILS_SRC)/screenshot.h
demo-Gtk.o: $(UTILS_SRC)/usleep.h
demo-Gtk.o: $(UTILS_SRC)/version.h
demo-Gtk.o: $(UTILS_SRC)/visual.h
demo-Gtk.o: $(UTILS_SRC)/xmu.h
demo-Gtk.o: $(UTILS_SRC)/xscreensaver-intl.h
demo-Xm.o: ../config.h
demo-Xm-widgets.o: ../config.h
passwd-kerberos.o: $(srcdir)/auth.h
passwd-kerberos.o: $(srcdir)/blurb.h
passwd-kerberos.o: ../config.h
passwd-pam.o: $(srcdir)/auth.h
passwd-pam.o: $(srcdir)/blurb.h
passwd-pam.o: ../config.h
passwd-pwent.o: $(srcdir)/auth.h
passwd-pwent.o: $(srcdir)/blurb.h
passwd-pwent.o: ../config.h
remote.o: $(srcdir)/atoms.h
remote.o: $(srcdir)/blurb.h
remote.o: $(srcdir)/clientmsg.h
remote.o: ../config.h
remote.o: $(srcdir)/remote.h
test-fade.o: $(srcdir)/atoms.h
test-fade.o: $(srcdir)/blurb.h
test-fade.o: ../config.h
test-fade.o: $(srcdir)/fade.h
test-fade.o: $(srcdir)/screens.h
test-fade.o: $(srcdir)/types.h
test-fade.o: $(UTILS_SRC)/resources.h
test-fade.o: $(srcdir)/xscreensaver.h
test-grab.o: $(srcdir)/blurb.h
test-grab.o: ../config.h
test-passwd.o: $(srcdir)/auth.h
test-passwd.o: $(srcdir)/blurb.h
test-passwd.o: ../config.h
test-randr.o: $(srcdir)/blurb.h
test-randr.o: ../config.h
test-screens.o: $(srcdir)/blurb.h
test-screens.o: ../config.h
test-screens.o: $(srcdir)/screens.h
test-screens.o: $(UTILS_SRC)/visual.h
test-uid.o: ../config.h
test-vp.o: $(srcdir)/blurb.h
test-vp.o: ../config.h
test-xdpms.o: $(srcdir)/blurb.h
test-xdpms.o: ../config.h
test-xinerama.o: $(srcdir)/blurb.h
test-xinerama.o: ../config.h
test-xinput.o: ../config.h
test-xinput.o: $(srcdir)/xinput.h
test-xkb.o: $(srcdir)/blurb.h
test-xkb.o: ../config.h
test-yarandom.o: $(srcdir)/blurb.h
test-yarandom.o: ../config.h
test-yarandom.o: $(UTILS_SRC)/yarandom.h
xscreensaver-command.o: $(srcdir)/atoms.h
xscreensaver-command.o: $(srcdir)/blurb.h
xscreensaver-command.o: ../config.h
xscreensaver-command.o: $(srcdir)/remote.h
xscreensaver-command.o: $(UTILS_SRC)/version.h
xscreensaver-systemd.o: $(srcdir)/blurb.h
xscreensaver-systemd.o: ../config.h
xscreensaver-systemd.o: $(UTILS_SRC)/queue.h
xscreensaver-systemd.o: $(UTILS_SRC)/version.h
xscreensaver-systemd.o: $(UTILS_SRC)/yarandom.h