File: Makefile.in

package info (click to toggle)
distcc 3.3.2-10
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,772 kB
  • sloc: ansic: 27,818; python: 6,425; sh: 4,435; makefile: 919; perl: 52
file content (1251 lines) | stat: -rw-r--r-- 43,843 bytes parent folder | download
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
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
# Top-level Makefile(.in) for distcc

# Copyright (C) 2002, 2003, 2004 by Martin Pool

# Note that distcc no longer uses automake, but this file is still
# structured in a somewhat similar way.

## VARIABLES

PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
SHELL = @SHELL@

# These autoconf variables may contain recursive Make expansions, and
# so they have to be done here rather than written into config.h.

CFLAGS = @CFLAGS@
WERROR_CFLAGS = @WERROR_CFLAGS@
PYTHON_CFLAGS = @PYTHON_CFLAGS@
POPT_CFLAGS = @POPT_CFLAGS@
POPT_INCLUDES = @POPT_INCLUDES@

LDFLAGS = @LDFLAGS@
CC = @CC@
CPP = @CPP@
# We add a few cppflags.  -Isrc is so that config.h can be found in the build
# directory.  It is before I"$(srcdir)/src" to reflect VPATH semantics.
CPPFLAGS = @CPPFLAGS@ ${DIR_DEFS} \
	   -Isrc -I"$(srcdir)/src" -I"$(srcdir)/lzo" $(POPT_INCLUDES)

PYTHON = @PYTHON@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
builddir = @builddir@
top_builddir = @top_builddir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
docdir = @docdir@
pkgdatadir = $(datadir)/@PACKAGE_NAME@

include_server_builddir = $(builddir)/_include_server

# These must be done from here, not from autoconf, because they can 
# contain variable expansions written in Make syntax.  Ew.
DIR_DEFS = -DLIBDIR="\"${libdir}\"" -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""

# arguments to pkgconfig
GNOME_PACKAGES = @GNOME_PACKAGES@
GNOME_CFLAGS = @GNOME_CFLAGS@
GNOME_LIBS = @GNOME_LIBS@

LIBS = @LIBS@

DESTDIR =

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ 
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# RESTRICTED_PATH is a colon separated list of directory names.  It
# contains the locations of 'make', 'sh', 'gcc', and 'python' for use
# in installation tests.  This path is used to avoid confusion caused
# by distcc masquerades on the normal path.  See the
# 'maintainer-check-no-set-path' target.
RESTRICTED_PATH = /usr/local/bin:/bin:/usr/bin

# The DISTCC_INSTALLATION variable is a colon separated list of
# directory names of possible locations for the installation to be
# checked.  Change the value of this variable to @bindir@ to check the
# installation at the location determined by 'configure'.
DISTCC_INSTALLATION = $(RESTRICTED_PATH)

dist_files =							\
	src/config.h.in						\
	$(dist_lzo)						\
	$(dist_contrib)						\
	$(dist_patches)						\
	$(dist_common)						\
	$(MEN)							\
	$(pkgdoc_DOCS)						\
	$(example_DOCS)						\
	$(popt_EXTRA) $(popt_SRC) $(popt_HEADERS)		\
	$(SRC) $(HEADERS)					\
	$(update_distcc_symlinks_PY)				\
	$(test_SOURCE)						\
	$(bench_PY)						\
	$(include_server_PY)                                    \
	$(dist_include_server_SH)                               \
	$(include_server_SRC)                                   \
	$(check_include_server_DATA)                            \
	$(check_include_server_PY)                              \
	$(conf_files)                                           \
	$(default_files)                                        \
	$(dist_extra)						\
	$(desktop_files)					\
	$(icon_files)

dist_dirs = m4 include_server/test_data

dist_lzo = lzo/minilzo.c \
	lzo/minilzo.h \
	lzo/lzoconf.h \
	lzo/lzodefs.h \
	lzo/.stamp-conf.in

dist_contrib = contrib/distcc-absolutify	\
	contrib/distcc.sh		\
	contrib/distccd-init		\
	contrib/distccd-on-servers	\
	contrib/dmake			\
	contrib/make-j			\
	contrib/netpwd			\
	contrib/stage-cc-wrapper.patch	\
	contrib/redhat/init		\
	contrib/redhat/logrotate		\
	contrib/redhat/sysconfig		\
	contrib/redhat/xinetd

dist_include_server_SH = \
	pump.in

bench_PY = bench/Build.py \
	bench/Project.py \
	bench/ProjectDefs.py \
	bench/Summary.py \
	bench/actions.py \
	bench/benchmark.py \
	bench/buildutil.py \
	bench/compiler.py \
	bench/statistics.py

pkgdoc_DOCS = AUTHORS COPYING NEWS \
	README README.pump \
	INSTALL \
	TODO \
	doc/protocol-1.txt doc/status-1.txt \
	doc/protocol-2.txt \
	doc/protocol-3.txt doc/protocol-3-impl.txt \
	doc/protocol-gssapi.txt \
	doc/reporting-bugs.txt \
	survey.txt

example_DOCS = \
	doc/example/README \
	doc/example/default \
	doc/example/hosts.allow \
	doc/example/services \
	doc/example/init doc/example/init-suse	\
	doc/example/logrotate				\
	doc/example/xinetd				\

include_server_PY = \
	include_server/basics.py \
	include_server/cache_basics.py \
	include_server/compiler_defaults.py \
	include_server/compress_files.py \
	include_server/include_analyzer.py \
	include_server/include_analyzer_memoizing_node.py \
	include_server/include_server.py \
	include_server/macro_eval.py \
	include_server/mirror_path.py \
	include_server/parse_command.py \
	include_server/parse_file.py \
	include_server/run.py \
	include_server/setup.py \
	include_server/statistics.py

include_server_SRC = \
	include_server/c_extensions/distcc_pump_c_extensions_module.c

update_distcc_symlinks_PY = update-distcc-symlinks.py

# These are included in the distribution but not installed anywhere.
dist_extra =							\
	README.packaging ChangeLog \
	packaging/RedHat/rpm.spec \
	packaging/RedHat/logrotate.d/distcc \
	packaging/RedHat/init.d/distcc \
	packaging/RedHat/xinetd.d/distcc \
	packaging/deb.sh \
	packaging/rpm.sh \
	packaging/googlecode_upload.py


mkinstalldirs = $(SHELL) $(srcdir)/mkinstalldirs
man1dir = $(mandir)/man1
man8dir = $(mandir)/man8

test_SOURCE = test/comfychair.py \
	test/onetest.py \
	test/testdistcc.py \
	find_c_extension.sh

dist_common = Makefile.in install-sh configure configure.ac \
	config.guess config.sub mkinstalldirs autogen.sh

# It seems a bit unnecessary to ship patches in the released tarballs.
# People who are so keen as to apply unsupported patches ought to use
# CVS, or at least get them from the list.
dist_patches = 

TAR = tar
GZIP_BIN = gzip
# This is set on the environment, and automatically read by gzip.
# This way we always get best compression, even when gzip is run in a
# script we call, rather than being called by us directly.
GZIP = -9v
BZIP2_BIN = bzip2

distdir = $(PACKAGE_TARNAME)-$(VERSION)
tarball = $(PACKAGE_TARNAME)-$(VERSION).tar
tarball_bz2 = $(tarball).bz2
tarball_gz = $(tarball).gz
tarball_sig_bz2 = $(tarball_bz2).asc
tarball_sig_gz = $(tarball_gz).asc
distnews = $(PACKAGE_TARNAME)-$(VERSION).NEWS

rpm_glob_pattern = "$(PACKAGE)"*[-_.]"$(VERSION)"[-_.]*.rpm
deb_glob_pattern = "$(PACKAGE)"*[-_.]"$(VERSION)"[-_.]*.deb

common_obj = src/arg.o src/argutil.o					\
	src/cleanup.o src/compress.o					\
	src/trace.o src/util.o src/io.o src/exec.o			\
	src/rpc.o src/tempfile.o src/bulk.o src/help.o src/filename.o	\
	src/lock.o							\
	src/netutil.o							\
	src/pump.o							\
	src/sendfile.o							\
	src/safeguard.o src/snprintf.o src/timeval.o			\
	src/dotd.o 							\
	src/hosts.o src/hostfile.o					\
	src/implicit.o src/loadfile.o					\
	lzo/minilzo.o                                                   \
	@ZEROCONF_COMMON_OBJS@						\
	@AUTH_COMMON_OBJS@

distcc_obj = src/backoff.o						\
	src/climasq.o src/clinet.o src/clirpc.o				\
	src/compile.o src/cpp.o						\
	src/distcc.o							\
	src/remote.o							\
	src/ssh.o src/state.o src/strip.o				\
	src/timefile.o src/traceenv.o					\
	src/include_server_if.o						\
	src/where.o							\
	@ZEROCONF_DISTCC_OBJS@						\
	@AUTH_DISTCC_OBJS@						\
	src/emaillog.o							\
	$(common_obj)

distccd_obj = src/access.o						\
	src/daemon.o  src/dopt.o src/dparent.o src/dsignal.o		\
	src/ncpus.o							\
	src/prefork.o							\
	src/stringmap.o							\
	src/serve.o src/setuid.o src/srvnet.o src/srvrpc.o src/state.o	\
	src/stats.o							\
	src/fix_debug_info.o						\
	@ZEROCONF_DISTCCD_OBJS@						\
	@AUTH_DISTCCD_OBJS@						\
	$(common_obj) @BUILD_POPT@

lsdistcc_obj = src/lsdistcc.o 						\
	src/clinet.o src/io.o src/netutil.o src/trace.o src/util.o 	\
	src/rslave.o src/snprintf.o                                     \
	lzo/minilzo.o

# Objects that need to be linked in to build monitors
mon_obj =								\
	src/cleanup.o							\
	src/filename.o							\
	src/io.o							\
	src/mon.o							\
	src/netutil.o							\
	src/argutil.o							\
	src/rpc.o							\
	src/snprintf.o src/state.o 					\
	src/tempfile.o src/trace.o src/traceenv.o			\
	src/util.o

gnome_obj = src/history.o src/mon-gnome.o				\
	src/renderer.o

h_exten_obj = src/h_exten.o $(common_obj)
h_issource_obj = src/h_issource.o $(common_obj)
h_scanargs_obj = src/h_scanargs.o $(common_obj)
h_hosts_obj = src/h_hosts.o $(common_obj)
h_argvtostr_obj = src/h_argvtostr.o $(common_obj)
h_strip_obj = src/h_strip.o $(common_obj) src/strip.o
h_parsemask_obj = src/h_parsemask.o $(common_obj) src/access.o
h_sa2str_obj = src/h_sa2str.o $(common_obj) src/srvnet.o src/access.o
h_ccvers_obj = src/h_ccvers.o $(common_obj)
h_dotd_obj = src/h_dotd.o $(common_obj)
h_fix_debug_info = src/h_fix_debug_info.o $(common_obj)
h_compile_obj = src/h_compile.o $(common_obj) src/compile.o src/timefile.o \
                src/backoff.o src/emaillog.o src/remote.o src/clinet.o \
	        src/clirpc.o src/include_server_if.o src/state.o src/where.o \
		src/ssh.o src/strip.o src/cpp.o @AUTH_DISTCC_OBJS@
h_getline_obj = src/h_getline.o $(common_obj)

# All source files, for the purposes of building the distribution
SRC =	src/stats.c							\
	src/access.c src/arg.c src/argutil.c				\
	src/auth_common.c src/auth_distcc.c src/auth_distccd.c		\
	src/backoff.c src/bulk.c					\
	src/cleanup.c							\
	src/climasq.c src/clinet.c src/clirpc.c src/compile.c		\
	src/compress.c src/cpp.c					\
	src/daemon.c src/distcc.c src/dsignal.c				\
	src/dopt.c src/dparent.c src/exec.c src/filename.c		\
	src/h_argvtostr.c						\
	src/h_exten.c src/h_hosts.c src/h_issource.c src/h_parsemask.c	\
	src/h_sa2str.c src/h_scanargs.c src/h_strip.c			\
	src/h_dotd.c src/h_compile.c src/h_getline.c			\
	src/help.c src/history.c src/hosts.c src/hostfile.c		\
	src/implicit.c src/io.c						\
	src/loadfile.c src/lock.c 					\
	src/mon.c src/mon-notify.c src/mon-text.c			\
	src/mon-gnome.c							\
	src/ncpus.c src/netutil.c					\
	src/prefork.c src/pump.c					\
	src/remote.c src/renderer.c src/rpc.c				\
	src/safeguard.c src/sendfile.c src/setuid.c src/serve.c		\
	src/snprintf.c src/state.c					\
	src/srvnet.c src/srvrpc.c src/ssh.c 				\
	src/stringmap.c src/strip.c					\
	src/tempfile.c src/timefile.c                     		\
	src/timeval.c src/traceenv.c					\
	src/trace.c src/util.c src/where.c				\
	src/lsdistcc.c src/rslave.c					\
	src/dotd.c src/include_server_if.c				\
	src/emaillog.c							\
	src/fix_debug_info.c						\
	src/zeroconf.c src/zeroconf-reg.c src/gcc-id.c


HEADERS = src/stats.h							\
	src/access.h							\
	src/auth.h							\
	src/bulk.h							\
	src/clinet.h src/compile.h					\
	src/daemon.h							\
	src/distcc.h src/dopt.h src/exitcode.h				\
	src/fix_debug_info.h						\
	src/hosts.h src/implicit.h					\
	src/mon.h							\
	src/netutil.h							\
	src/renderer.h src/rpc.h					\
	src/snprintf.h src/state.h		 			\
	src/stringmap.h							\
	src/timefile.h src/timeval.h src/trace.h			\
	src/types.h							\
	src/util.h							\
	src/exec.h src/lock.h src/where.h src/srvnet.h			\
	src/rslave.h							\
	src/dotd.h src/include_server_if.h				\
	src/emaillog.h 							\
	src/va_copy.h 							\
	src/zeroconf.h

conf_dir = packaging/RedHat/conf
conf_files = $(conf_dir)/hosts \
	     $(conf_dir)/clients.allow \
	     $(conf_dir)/commands.allow.sh
default_dir = packaging/RedHat/default
default_files = $(default_dir)/distcc

man1_MEN = man/distcc.1 man/distccd.1 man/distccmon-text.1 \
           man/lsdistcc.1 man/pump.1 man/include_server.1
man_HTML = man/distcc_1.html man/distccd_1.html man/distccmon_text_1.html \
           man/lsdistcc_1.html man/pump_1.html man/include_server_1.html
MEN = $(man1_MEN)

gnome_data = gnome/distccmon-gnome-icon.png	\
	gnome/distccmon-gnome.desktop

popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
	popt/popthelp.o popt/poptparse.o

popt_SRC=popt/findme.c  popt/popt.c  popt/poptconfig.c			 \
	popt/popthelp.c popt/poptparse.c

popt_HEADERS = popt/findme.h popt/popt.h popt/poptint.h popt/system.h

popt_EXTRA = popt/README.popt popt/.stamp-conf.in


# You might think that distccd ought to be in sbin, because it's a
# daemon.  It is a grey area.  However, the Linux Filesystem Hierarchy
# Standard (FHS 2.2) says that sbin is for programs "used exclusively
# by the system administrator".  

# distccd will often be used by non-root users, and when we support
# ssh it will be somewhat important that it be found in their default
# path.  Therefore on balance it seems better to put it in bin/.  

# Package maintainers can override this if absolutely necessary, but I
# would prefer that they do not. -- mbp

bin_PROGRAMS = \
	distcc@EXEEXT@ \
	distccd@EXEEXT@ \
	distccmon-text@EXEEXT@ \
	lsdistcc@EXEEXT@ \
	@GNOME_BIN@ 

sbin_PROGRAMS = \
	update-distcc-symlinks

check_PROGRAMS = \
	h_argvtostr@EXEEXT@ \
	h_exten@EXEEXT@ \
	h_fix_debug_info@EXEEXT@ \
	h_hosts@EXEEXT@ \
	h_issource@EXEEXT@ \
	h_parsemask@EXEEXT@ \
	h_sa2str@EXEEXT@ \
	h_scanargs@EXEEXT@ \
	h_strip@EXEEXT@ \
	h_dotd@EXEEXT@ \
	h_compile@EXEEXT@ \
	h_getline@EXEEXT@

check_include_server_PY = \
	include_server/c_extensions_test.py \
	include_server/include_server_test.py \
	include_server/macro_eval_test.py \
	include_server/mirror_path_test.py \
	include_server/parse_command_test.py \
	include_server/parse_file_test.py \
	include_server/include_analyzer_test.py \
	include_server/include_analyzer_memoizing_node_test.py \
	include_server/basics_test.py


######################################################################
## IMPLICIT BUILD rules

.SUFFIXES: .html .latte .o .c

.c.o:
	$(CC) $(CPPFLAGS) $(WERROR_CFLAGS) $(CFLAGS) -o $@ -c $<


######################################################################
## OVERALL targets

.PHONY: all include-server

## NOTE: "all" must be the first (default) rule, aside from patterns.

all: $(bin_PROGRAMS) $(sbin_PROGRAMS) pump include-server

#  src/config.h.in is used by config.status
Makefile: Makefile.in src/config.h.in config.status
	./config.status


######################################################################
## BUILD targets

# We would like to detect when config.h.in has changed: this should trigger
# config.status to be rerun. But if the config.h file actually does not change
# as a result of running config.status (a feature of autoconf), then
# config.status will be rerun every time. That's confusing. So, the rule
#
# src/config.h: src/config.h.in
#        ./config.status
#
# is not sufficient.

src/config.h: src/config.h.stamp

src/config.h.stamp: src/config.h.in
	echo "path: $$PATH"
	./config.status
	touch src/config.h.stamp

pump: pump.in config.status
	./config.status

# Grab the dependency files generated by gcc's -MD option.
-include */*.d

# Disable some warnings for popt/*.c.
$(popt_OBJS): CFLAGS += $(POPT_CFLAGS)

distcc@EXEEXT@: $(distcc_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(distcc_obj) $(LIBS)

distccd@EXEEXT@: $(distccd_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(distccd_obj) $(LIBS)	

distccmon-text@EXEEXT@: $(mon_obj) src/mon-text.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(mon_obj) src/mon-text.o $(LIBS)

lsdistcc@EXEEXT@: $(lsdistcc_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(lsdistcc_obj) $(LIBS)

update-distcc-symlinks: $(update_distcc_symlinks_PY)
	cp $< $@

h_exten@EXEEXT@: $(h_exten_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_exten_obj) $(LIBS)

h_issource@EXEEXT@: $(h_issource_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_issource_obj) $(LIBS)

h_sa2str@EXEEXT@: $(h_sa2str_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_sa2str_obj) $(LIBS)

h_scanargs@EXEEXT@: $(h_scanargs_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_scanargs_obj) $(LIBS)

h_hosts@EXEEXT@: $(h_hosts_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_hosts_obj) $(LIBS)

h_argvtostr@EXEEXT@: $(h_argvtostr_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_argvtostr_obj) $(LIBS)

h_parsemask@EXEEXT@: $(h_parsemask_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_parsemask_obj) $(LIBS)

h_strip@EXEEXT@: $(h_strip_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_strip_obj) $(LIBS)

h_ccvers@EXEEXT@: $(h_ccvers_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_ccvers_obj) $(LIBS)

h_dotd@EXEEXT@: $(h_dotd_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_dotd_obj) $(LIBS)

h_fix_debug_info@EXEEXT@: $(h_fix_debug_info)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_fix_debug_info) $(LIBS)

h_compile@EXEEXT@: $(h_compile_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_compile_obj) $(LIBS)

h_getline@EXEEXT@: $(h_getline_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_getline_obj) $(LIBS)


src/h_fix_debug_info.o: src/fix_debug_info.c
	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) \
		-DTEST \
		$(srcdir)/src/fix_debug_info.c

src/mon-gnome.o: src/mon-gnome.c
	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) \
		$(GNOME_CFLAGS) \
		$(srcdir)/src/mon-gnome.c

src/renderer.o: src/renderer.c
	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS)			\
		$(GNOME_CFLAGS) \
		$(srcdir)/src/renderer.c

distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
	$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
		$(mon_obj) $(gnome_obj) \
		$(LIBS) $(GNOME_CFLAGS) $(GNOME_LIBS)

# The include-server is a python app, so we use Python's build system.  We pass
# the distcc version, the source location, the CPP flags (for location of the
# includes), and the build location.
include-server:
	if test -z "$(PYTHON)"; then	\
	  echo "Not building $@: No suitable python found"; \
	else						\
	  mkdir -p "$(include_server_builddir)" &&      \
	  DISTCC_VERSION="$(VERSION)"			\
	  SRCDIR="$(srcdir)"                            \
	  CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)"           \
	  CPPFLAGS="$(CPPFLAGS)"                        \
	  $(PYTHON) "$(srcdir)/include_server/setup.py" \
	      build 					\
	        --build-base="$(include_server_builddir)"  \
	        --build-temp="$(include_server_builddir)"; \
	fi


######################################################################
## DIST TARGETS

.PHONY: dist distcheck dist-sign dist-files

# The sub-targets copy (and if necessary, build) various files that
# have to go into the tarball.  They also create necessary directories
# -- bear in mind that they might be run in parallel.

# This looks a bit gross to me, but it's not as bad as it might be :-/

# TODO(csilvers): add 'make rpm' and 'make deb'.

dist:
	-rm -fr "$(distdir)"
	$(MAKE) dist-files 
	$(TAR) cf "$(tarball)" "$(distdir)"
	$(GZIP_BIN) --help >/dev/null && \
		$(GZIP_BIN) -fc "$(tarball)" > "$(tarball_gz)"
	$(BZIP2_BIN) --help 2>/dev/null && \
		$(BZIP2_BIN) -vfc "$(tarball)" > "$(tarball_bz2)"
	rm -f "$(tarball)"
	rm -fr "$(distdir)"
	cp "$(srcdir)/NEWS" "$(distnews)"

# We create two new directories: one for the build and one to install,
# and make sure we can build and install from different directories
# than the source directory.  Then we run a "make distclean" and
# verify it got rid of everything not in the tarball by deleting every
# file mentioned in the tarball, and then making sure nothing is left.
distcheck: dist
	[ ! -d +distcheck ] || chmod -R u+w +distcheck
	rm -rf '+distcheck'
	mkdir '+distcheck'
	cd '+distcheck' && $(GZIP_BIN) -d < "../$(tarball_gz)" | $(TAR) xvf -
	mkdir "+distcheck/$(distdir)/_build"
	mkdir "+distcheck/$(distdir)/_inst"
	chmod -R a-w +distcheck
	chmod u+w "+distcheck/$(distdir)/_build" "+distcheck/$(distdir)/_inst"
	dc_install_base=`cd "+distcheck/$(distdir)/_inst" && pwd` \
	&& cd "+distcheck/$(distdir)/_build" \
	&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
	&& $(MAKE) && $(MAKE) maintainer-check \
	&& $(MAKE) install \
	&& $(MAKE) DISTCC_INSTALLATION="$$dc_install_base/bin" \
	        maintainer-installcheck \
	&& $(MAKE) distclean
	chmod -R u+w +distcheck
	test `find "+distcheck/$(distdir)/_build" -type f -print | wc -l` -eq 0 \
		|| { echo "ERROR: files left in build-dir after distclean:"; \
                     find "+distcheck/$(distdir)/_build" -type f -print; \
	             rm -rf '+distcheck'; \
	             exit 1; }
	rm -rf '+distcheck'

dist-sign:
	gpg -a --detach-sign "$(tarball_bz2)"

# For the dirs we copy, we don't want to copy control files like '.cvs'.
# We use find for this; if 'find' doesn't work, just don't worry about it.
dist-files: $(dist_files)
	for f in $(dist_files) $(dist_dirs); do \
	  mkdir -p "$(distdir)"/`dirname "$$f"` || exit 1; \
	  cp -pR "$(srcdir)/$$f" "$(distdir)/$$f" 2>/dev/null || \
	      cp -pR "$$f" "$(distdir)/$$f" || exit 1; \
	done
	for f in $(dist_dirs); do \
	  find "$(distdir)/$$f" -name '.[^.]*' -exec rm -rf \{\} \; -prune ; \
	done


######################################################################
## BUILD manual targets

man/distcc_1.html: man/distcc.1
	troff2html -man "$(srcdir)"/man/distcc.1 > $@

man/distccd_1.html: man/distccd.1
	troff2html -man "$(srcdir)"/man/distccd.1 > $@

man/distccmon_text_1.html: man/distccmon-text.1
	troff2html -man "$(srcdir)"/man/distccmon-text.1 > $@

man/lsdistcc_1.html: man/lsdistcc.1
	troff2html -man "$(srcdir)"/man/lsdistcc.1 > $@

man/pump_1.html: man/pump.1
	troff2html -man "$(srcdir)"/man/pump.1 > $@

man/include_server_1.html: man/include_server.1
	troff2html -man "$(srcdir)"/man/include_server.1 > $@

######################################################################
## CHECK targets for code that has been build.

.PHONY: check_programs
.PHONY: maintainer-check-no-set-path distcc-maintainer-check
.PHONY: include-server-maintainer-check pump-maintainer-check
.PHONY: maintainer-check 
.PHONY: check
.PHONY: lzo-check valgrind-check single-test pump-single-test

check_programs: $(check_PROGRAMS) $(bin_PROGRAMS)

TESTDISTCC_OPTS =

# This target is for internal use by distcc-maintainer-check and
# distcc-installcheck.  These rules differ only in their choice of the value of
# PATH to use.  PATH must be set appropriately so that python, distcc binaries,
# gcc, and those of the check_PROGRAMS, can be found on PATH.  This is done in
# the call of this target through use of the variable RESTRICTED_PATH.
#
# The more prominent of these conditions are checked explicitly checked below.
#
# TODO(klarlund): the outermost if assumes that the include-server target may be
# satisfied w/o actually building an include server (or rather the C extension);
# this logic needs to be verified or amended.
maintainer-check-no-set-path:
	@if ! $(PYTHON) -c 'import sys; print(sys.version)'; then \
	  echo "WARNING: python not found; tests skipped"; \
	else \
	  if ! $(CC) --version 2>/dev/null; then \
	    echo "Could not find CC on the restricted path used to avoid"; \
	    echo "confusion caused by distcc masquerades on the normal path."; \
	    echo "PATH is currently '$$PATH'."; \
	    echo "Please change RESTRICTED_PATH to change this PATH value."; \
	    exit 1; \
	  fi; \
	  $(PYTHON) "$(srcdir)/test/testdistcc.py" $(TESTDISTCC_OPTS); \
	fi

distcc-maintainer-check: check_programs
	 $(MAKE) PATH="`pwd`:$(RESTRICTED_PATH)" \
	   TESTDISTCC_OPTS="$(TESTDISTCC_OPTS)" maintainer-check-no-set-path

# If the include server extension module was built, then run the tests include
# server.  TODO(klarlund): the outermost if assumes that the include-server
# target may be satisfied w/o actually building an include server (or rather the
# C extension); this logic needs to be verified or amended.
# TODO(csilvers): keep track of failures instead of exiting on the first one.
include-server-maintainer-check: include-server
	@if ! test -d "$(include_server_builddir)"; then \
	  echo "Skipped include-server check"; \
	else \
	  CURDIR=`pwd`; \
	  include_server_loc=`"$(srcdir)/find_c_extension.sh" "$(builddir)"`; \
	  test $$? = 0 || (echo 'Could not locate extension.' 1>&2 && exit 1); \
	  cd "$(srcdir)/include_server"; \
	  for p in $(check_include_server_PY); do \
	    p_base=`basename "$$p"`; \
	    echo "Running:" \
              "PYTHONPATH=$$CURDIR/$$include_server_loc:$$PYTHONPATH $(PYTHON) $$p_base"; \
	    if PYTHONPATH="$$CURDIR/$$include_server_loc:$$PYTHONPATH" $(PYTHON) "$$p_base" \
		 > "$$CURDIR/$(tempdir)/$$p_base.out" 2>&1; then \
	      echo "PASS"; \
	      rm "$$CURDIR/$(tempdir)/$$p_base.out"; \
            else \
              echo "FAIL"; cat "$$CURDIR/$(tempdir)/$$p_base.out"; exit 1; \
	    fi; \
	  done; \
	fi

# Do distcc-maintainer-check in pump-mode, if possible.
pump-maintainer-check: pump include-server check_programs
	@if [ -d "$(include_server_builddir)" ]; then \
	  DISTCC_HOSTS='<invalid>,cpp,lzo' \
	    "$(builddir)/pump" \
	        $(MAKE) \
	        RESTRICTED_PATH="$(RESTRICTED_PATH)" \
	        TESTDISTCC_OPTS="--pump $(TESTDISTCC_OPTS)" \
	        distcc-maintainer-check; \
	fi

# Do distcc-maintainer-check, for non-pumped distcc, and try the include_server
# check to check the include server's behavior, if applicable.  If the include
# server exists, then carry out distcc-maintainer-check in pump-mode.
maintainer-check: distcc-maintainer-check include-server-maintainer-check \
	pump-maintainer-check

check:
	@if test -n "$(PYTHON)"; then \
	   $(MAKE) maintainer-check; \
	elif test -n "$(PYTHON)"; then \
	   echo "WARNING: pump-mode not being tested"; \
	   $(MAKE) distcc-maintainer-check; \
	else \
	   echo "Cannot run tests: python binary not found"; \
	   false; \
	fi

# Runs the tests in lzo-mode.
lzo-check:
	$(MAKE) TESTDISTCC_OPTS=--lzo maintainer-check

# Runs the tests with valgrind.
valgrind-check:
	$(MAKE) TESTDISTCC_OPTS=--valgrind maintainer-check

# The following target is useful for running a single test at a time.
# Sample usage:
#    make TESTNAME=Lsdistcc_Case single-test
#    make TESTNAME=Lsdistcc_Case TESTDISTCC_OPTS=--valgrind single-test
TESTNAME = NoDetachDaemon_Case  # Override this with the desired test.
single-test: check_programs
	PATH="`pwd`:$(RESTRICTED_PATH)" \
	    $(PYTHON) "$(srcdir)/test/onetest.py" $(TESTDISTCC_OPTS) $(TESTNAME)

# Run a single test in pump-mode.
pump-single-test: pump include-server check_programs
	DISTCC_HOSTS='<invalid>,cpp,lzo' \
	    "$(builddir)/pump" \
	        $(MAKE) \
	        RESTRICTED_PATH="$(RESTRICTED_PATH)" \
	        TESTDISTCC_OPTS="--pump $(TESTDISTCC_OPTS)" \
	        single-test

######################################################################
## CHECK targets for code that has been installed.

.PHONY: pump-installcheck distcc-installcheck maintainer-installcheck
.PHONY: installcheck verify-binaries-installcheck daemon-installcheck

# Verify that DISTCC_INSTALLATION contains the expected set of binaries.
verify-binaries-installcheck:
	@echo "Locating binaries in" \
	      "DISTCC_INSTALLATION='$(DISTCC_INSTALLATION)'"
	@echo "To use installation in @bindir@, remake with" \
	       "argument 'DISTCC_INSTALLATION=@bindir@'."
	@echo "Make sure all paths below are where you expect them to be:"
	@echo "**********************************************************"
	@for p in $(bin_PROGRAMS); do \
	  if ! PATH="$(DISTCC_INSTALLATION)" `which which` "$$p"; then \
	    echo "Binary '$$p' could not be found in DISTCC_INSTALLATION."; \
	    exit 1; \
	  fi; \
	done 
	@echo "**********************************************************"

# Lookup distcc programs to be checked in $(DISTCC_INSTALLATION).  The
# check_PROGRAMS binaries, however, are to be found in $(builddir).
distcc-installcheck: $(check_PROGRAMS)
	BUILDDIR=`cd "$(builddir)" && pwd`; \
	PATH="$(DISTCC_INSTALLATION):$$BUILDDIR:$(RESTRICTED_PATH)" \
	  TESTDISTCC_OPTS="$(TESTDISTCC_OPTS)" \
	  $(MAKE) maintainer-check-no-set-path

# Check the installation to see whether pump-mode works.
pump-installcheck:
	which_loc=`which which`; \
	pump_loc=`PATH="$(DISTCC_INSTALLATION)" "$$which_loc" pump`; \
	DISTCC_HOSTS='<invalid>,cpp,lzo' \
	  "$$pump_loc" \
            $(MAKE) DISTCC_INSTALLATION="$(DISTCC_INSTALLATION)" \
	      RESTRICTED_PATH="$(RESTRICTED_PATH)" \
              TESTDISTCC_OPTS=--pump distcc-installcheck; \

# "make maintainer-installcheck" verifies the currently installed version in
# RESTRICTED_PATH.  It does not have the "install" target as a dependency so
# that you can can check an installation that is installed via some different
# method (e.g. rpm or debian package).  You must specify the location of such an
# installation by overriding the value of DISTCC_INSTALLATION.
#
# The maintainer-installcheck does not run the include server unit tests;
# but the integration tests in 'test' are run in pump mode.
maintainer-installcheck: verify-binaries-installcheck distcc-installcheck \
	pump-installcheck

installcheck:
	@if test -n "$(PYTHON)"; then \
	   $(MAKE) maintainer-installcheck; \
	elif test -n "$(PYTHON)"; then \
	   echo "WARNING: pump-mode not being tested"; \
	   $(MAKE) distcc-maintainer-installcheck; \
	else \
	   echo "Cannot run install-tests: python binary not found"; \
	   false; \
	fi

# This tests that the distcc daemon is running, and that it and distcc
# and the pump script have been installed correctly, by compiling a simple
# hello world program with distcc and distcc-pump.
# This can be used after "make install-deb".
#
# This uses distcc from your PATH and (for the first test)
# may use DISTCC_HOSTS from your environment or /etc/distcc/hosts.
#
# This test might fail if the --allow options passed to distccd
# (which may be set in the /etc/distcc/clients.allow file)
# do not include 127.0.0.1.
daemon-installcheck:
	mkdir -p _testtmp/daemon-installcheck && \
	    cd _testtmp/daemon-installcheck && \
	    echo '#include <stdio.h>' > hello.c && \
	    echo 'int main(void) { puts("hello world"); return 0; }' >> hello.c && \
	    rm -f hello.o && \
	    DISTCC_FALLBACK=0 distcc $(CC) $(CFLAGS) -c hello.c -o hello.o && \
	    test -f hello.o && \
	    rm -f hello.o && \
	    DISTCC_POTENTIAL_HOSTS=127.0.0.1 DISTCC_FALLBACK=0 \
	        pump distcc $(CC) $(CFLAGS) -c hello.c -o hello.o && \
	    test -f hello.o

######################################################################
## BENCHMARK targets

.PHONY: benchmark

benchmark: 
	@echo "The distcc macro-benchmark uses your existing distcc installation"
	@if [ -n "$$DISTCC_HOSTS" ]; \
	then echo "DISTCC_HOSTS=\"$$DISTCC_HOSTS\""; \
	else echo "You must set up servers and set DISTCC_HOSTS before running the benchmark"; \
	exit 1; \
	fi
	@echo "This benchmark may download a lot of source files, and it takes a "
	@echo "long time to run.  Interrupt now if you want."
	@echo 
	@echo "Pass BENCH_ARGS to make to specify which benchmarks to run."
	@echo
	@sleep 5
	cd bench && $(PYTHON) benchmark.py $(BENCH_ARGS)


######################################################################
## CLEAN targets

.PHONY: clean clean-autoconf clean-lzo clean-include-server
.PHONY: maintainer-clean maintainer-clean-autoconf distclean distclean-autoconf

# Also clean binaries which are optionally built. Also remove .d files; old ones
# may confuse 'make'.
clean: clean-autoconf clean-lzo clean-include-server
	rm -f src/*.[od] popt/*.[od]
	rm -f test/*.pyc
	rm -f $(check_PROGRAMS) $(bin_PROGRAMS) $(sbin_PROGRAMS)
	rm -f `echo $(man1_MEN) | sed -e 's/ /.gz /g' -e 's/$$/.gz/'`
	rm -f $(man_HTML)
	rm -f distccmon-gnome
	rm -rf _testtmp  # produced by test/testdistcc.py and daemon-installcheck
	rm -rf +distcheck
	rm -rf "$(include_server_builddir)"

clean-autoconf:
	rm -f config.cache config.log

clean-lzo:
	rm -f lzo/*.[od] lzo/testmini


clean-include-server:
	if test -n "$(PYTHON)"; then	\
	  DISTCC_VERSION="$(VERSION)"			\
	  SRCDIR="$(srcdir)"                            \
	  CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)"           \
	  CPPFLAGS="$(CPPFLAGS)"                        \
	  $(PYTHON) "$(srcdir)/include_server/setup.py" \
	      clean	\
	         --build-base="$(include_server_builddir)"  \
	         --build-temp="$(include_server_builddir)"; \
	fi

maintainer-clean: distclean \
	maintainer-clean-autoconf clean

# configure and co are distributed, but not in CVS
maintainer-clean-autoconf:
	rm -f configure src/config.h.in

distclean-autoconf:
	rm -f Makefile src/config.h src/config.h.stamp pump
	rm -f popt/.stamp-conf lzo/.stamp-conf
	rm -f config.status config.cache config.log aclocal.m4
	rm -rf autom4te.cache

distclean: distclean-autoconf clean


######################################################################
## MAINTAINER targets

.PHONY: man-html upload-man upload-dist rpm deb install-deb

man-html: $(man_HTML)
	mkdir -p doc/web/man
	cp -f $(man_HTML) doc/web/man

upload-man: man-html
	svn commit doc/web/man

# When uploading the package, we try to update the website as well.
# However, that's just best-effort, and if we can't (because, say, we
# don't have troff2html installed), we just upload the tarballs.
upload-dist: alldist
	-$(MAKE) upload-man
	"$(srcdir)/packaging/googlecode_upload.py" \
	    "$(tarball_gz)" \
	    "$(tarball_bz2)" \
	    packaging/$(rpm_glob_pattern) \
	    packaging/$(deb_glob_pattern)

rpm: dist packaging/rpm.sh packaging/RedHat/rpm.spec
	cd packaging && ./rpm.sh $(PACKAGE) $(VERSION)

# This uses the output of 'make rpm' to convert rpm files to deb files
deb: rpm packaging/deb.sh
	cd packaging && ./deb.sh $(PACKAGE) $(VERSION) *.rpm

# We copy .deb files to /tmp to avoid problems with NFS root_squash.
install-deb: deb
	tmpdir=`mktemp -d /tmp/distcc-install-deb-XXXXXX` && \
	cp packaging/*.deb $$tmpdir && \
	cd "$$tmpdir" && \
	sudo dpkg -i $(deb_glob_pattern) && \
	rm -rf $$tmpdir

# deb creates rpm files first, which in turn creates .gz files
alldist: deb
	@echo dist files created:
	@ls -1 "$(tarball_gz)" "$(tarball_bz2)"
	@ls -1 packaging/$(rpm_glob_pattern)
	@ls -1 packaging/$(deb_glob_pattern)

### INSTALL (and UNINSTALL) targets

.PHONY: showpaths install install-programs install-include-server
.PHONY: install-man install-doc install-example install-gnome-data 
.PHONY: install-conf

# TODO: Allow root directory to be overridden for use in building
# packages.

showpaths:
	@echo "'make install' will install distcc as follows:"
	@echo "  man pages            $(DESTDIR)$(man1dir)"
	@echo "  documents            $(DESTDIR)$(docdir)"
	@echo "  programs             $(DESTDIR)$(bindir)"
	@echo "  sbin programs        $(DESTDIR)$(sbindir)"
	@echo "  system configuration $(DESTDIR)$(sysconfdir)"
	@echo "  shared data files    $(DESTDIR)$(pkgdatadir)"


# install-sh can't handle multiple arguments, but we don't need any
# tricky features so mkinstalldirs and cp will do

install: showpaths install-doc install-man install-programs \
	install-include-server install-example @INSTALL_GNOME@

install-programs: $(bin_PROGRAMS) $(sbin_PROGRAMS)
	$(mkinstalldirs) "$(DESTDIR)$(bindir)"
	$(mkinstalldirs) "$(DESTDIR)$(sbindir)"
	for p in $(bin_PROGRAMS); do \
	  $(INSTALL_PROGRAM) "$$p" "$(DESTDIR)$(bindir)" || exit 1; \
	done
	for p in $(sbin_PROGRAMS); do \
	  $(INSTALL_PROGRAM) "$$p" "$(DESTDIR)$(sbindir)" || exit 1; \
	done

# See comments for the include-server target.  Also, we work around an issue in
# the change_root function of distutils/utils.py that turns the absolute prefix
# into a relative reference if the root is the empty string: we absolutize the
# destination directory in order to substitute '/' for the empty prefix (the
# default) when defining the '--root' parameter.
# The final complex issue involves installing pump.  pump wants to
# know the installed-location of include_server.py.  The only way to
# tell is to have setup.py install it, and then look what it says (via
# the --record output).  So when installing pump, we look at the
# --record output and modify the installed pump to have that location.
# Note: --record output is inconsistent (buggy?) and sometimes leaves out
# the leading slash in $prefix, even though we require prefix start with
# a slash.  We use sed to add it back in at cp time.
# Also, on Cygwin the --record output is in DOS text file format (CR LF
# line endings), so we need to convert it from DOS text file format to
# Unix text file format (LF line endings); we use sed for that too.
install-include-server: include-server pump
	if test -z "$(PYTHON)"; then	\
	  echo "Not building $@: No suitable python found"; \
	else						\
	  mkdir -p "$(include_server_builddir)" &&      \
	  DESTDIR=`cd "$(DESTDIR)/" && pwd` &&            \
	  DISTCC_VERSION="$(VERSION)"			\
	  SRCDIR="$(srcdir)"                            \
	  CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)"           \
	  CPPFLAGS="$(CPPFLAGS)"                        \
	  $(PYTHON) "$(srcdir)/include_server/setup.py" \
	      build 					\
	        --build-base="$(include_server_builddir)" \
	        --build-temp="$(include_server_builddir)" \
	      install 					\
	         --prefix="$(prefix)/lib/distcc-pump"	\
	         --record="$(include_server_builddir)/install.log.pre" \
	         --root="$$DESTDIR"                     \
	    || exit 1; \
	  sed -e '/^[^\/]/ s,^,/,' \
	      -e 's/\r$$//' \
	      "$(include_server_builddir)/install.log.pre" \
	      > "$(include_server_builddir)/install.log"; \
	  if test -n "$(PYTHON_INSTALL_RECORD)"; then \
	    cp -f "$(include_server_builddir)/install.log" "$(PYTHON_INSTALL_RECORD)"; \
	  fi; \
	  $(mkinstalldirs) "$(DESTDIR)$(bindir)" && \
	  INCLUDE_SERVER="/usr/lib/distcc-pump/include_server/include_server.py" && \
	  sed "s,^include_server='',include_server='$$INCLUDE_SERVER'," \
	    pump > "$(include_server_builddir)/pump" && \
	  $(INSTALL_PROGRAM) "$(include_server_builddir)/pump" "$(DESTDIR)$(bindir)"; \
	fi

install-man: $(man1_MEN)
	$(mkinstalldirs) "$(DESTDIR)$(man1dir)"
	for p in $(man1_MEN); do \
	  if $(GZIP_BIN) --help >/dev/null; then \
	    mkdir -p "`dirname $$p`"; \
	    if [ -e "$(DESTDIR)$(man1dir)$$p" ]; then rm -fv "$(DESTDIR)$(man1dir)$$p"; fi; \
	    $(GZIP_BIN) < "$(srcdir)/$$p" > "$$p.gz"; \
	    $(INSTALL_DATA) "$$p.gz" "$(DESTDIR)$(man1dir)" || exit 1; \
	  else \
	    echo "Warning: no working gzip, installing man pages uncompressed" 1>&2; \
	    if [ -e "$(DESTDIR)$(man1dir)$$p.gz" ]; then rm -fv "$(DESTDIR)$(man1dir)$$p.gz"; fi; \
	    $(INSTALL_DATA) "$(srcdir)/$$p" "$(DESTDIR)$(man1dir)" || exit 1; \
	  fi; \
	done

install-doc: $(pkgdoc_DOCS)
	$(mkinstalldirs) "$(DESTDIR)$(docdir)"
	for p in $(pkgdoc_DOCS); do \
	  $(INSTALL_DATA) "$(srcdir)/$$p" "$(DESTDIR)$(docdir)" || exit 1; \
	done

install-example: $(example_DOCS)
	$(mkinstalldirs) "$(DESTDIR)$(docdir)/example"
	for p in $(example_DOCS); do \
	  $(INSTALL_DATA) "$(srcdir)/$$p" "$(DESTDIR)$(docdir)/example" || exit 1; \
	done

install-gnome-data: $(desktop_files) $(icon_files)
	$(mkinstalldirs) "$(DESTDIR)$(desktopdir)"
	$(mkinstalldirs) "$(DESTDIR)$(icondir)"
	for p in $(desktop_files); do				\
	$(INSTALL_DATA) "$$p" "$(DESTDIR)$(desktopdir)" || exit 1; \
	done
	for p in $(icon_files); do				\
	$(INSTALL_DATA) "$$p" "$(DESTDIR)$(icondir)" || exit 1; \
	done

install-conf: $(conf_files) $(default_files)
	$(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc"
	$(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/default"
	@for p in $(conf_files); do                              \
	  base=`basename $$p`;                                   \
	  target="$(DESTDIR)$(sysconfdir)/distcc/$$base";        \
	  if test -e "$$target"; then                            \
	    echo "******************************************";   \
	    echo "*** Configuration file '$$target'";            \
	    echo "*** already exists; not installing '$$p'.";    \
	  else                                                   \
	    echo "$(INSTALL_DATA) $(srcdir)/$$p $$target";       \
	    $(INSTALL_DATA) "$(srcdir)/$$p" "$$target"           \
	        || exit 1;                                       \
	  fi;                                                    \
	done
	@for p in $(default_files); do                           \
	  base=`basename $$p`;                                   \
	  target="$(DESTDIR)$(sysconfdir)/default/$$base";       \
	  if test -e "$$target"; then                            \
	    echo "******************************************";   \
	    echo "*** Configuration file '$$target'";            \
	    echo "*** already exists; not installing '$$p'.";    \
	  else                                                   \
	    echo "$(INSTALL_DATA) $(srcdir)/$$p $$target";       \
	    $(INSTALL_DATA) "$(srcdir)/$$p" "$$target"           \
	        || exit 1;                                       \
	  fi;                                                    \
	done

# For best results, uninstall-example has to run before uninstall-doc,
# so we clean up the doc subdirectory before cleaning up doc itself.

uninstall: uninstall-man uninstall-programs @UNINSTALL_GNOME@ \
	uninstall-include-server uninstall-example uninstall-doc uninstall-conf

uninstall-programs:
	for p in $(bin_PROGRAMS) pump; do			\
	  file="$(DESTDIR)$(bindir)/`basename $$p`";            \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	for p in $(sbin_PROGRAMS); do			\
	  file="$(DESTDIR)$(sbindir)/`basename $$p`";            \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	-[ "`basename $(bindir)`" = "$(PACKAGE)" ] && rmdir "$(DESTDIR)$(bindir)"
	-[ "`basename $(sbindir)`" = "$(PACKAGE)" ] && rmdir "$(DESTDIR)$(sbindir)"

# There's no setup.py --uninstall. :-( So I depend on
# PYTHON_INSTALL_RECORD being set.  If it was used at --install time,
# I can use it again to uninstall.
uninstall-include-server:
	if [ -e "$(PYTHON_INSTALL_RECORD)" ]; then              \
	  cat "$(PYTHON_INSTALL_RECORD)" | xargs rm -fv;        \
	  cat "$(PYTHON_INSTALL_RECORD)" | sed 's/py$/pyc/' | xargs rm -fv; \
	  cat "$(PYTHON_INSTALL_RECORD)" | sed 's/py$/pyo/' | xargs rm -fv; \
	else                                                    \
	  echo "Cannot uninstall include-server: no PYTHON_INSTALL_RECORD"; \
	fi

uninstall-man:
	for p in $(man1_MEN); do				\
	  file="$(DESTDIR)$(man1dir)/`basename $$p`";           \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	  if [ -e "$$file.gz" ]; then rm -fv "$$file.gz"; fi    \
	done
	-[ "`basename $(man1dir)`" = "$(PACKAGE)" ] && rmdir "$(DESTDIR)$(man1dir)"

uninstall-doc:
	for p in $(pkgdoc_DOCS); do				\
	  file="$(DESTDIR)$(docdir)/`basename $$p`";            \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	-[ "`basename $(docdir)`" = "$(PACKAGE)" ] && rmdir "$(DESTDIR)$(docdir)"

uninstall-example:
	for p in $(example_DOCS); do				\
	  file="$(DESTDIR)$(docdir)/example/`basename $$p`";    \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	-rmdir "$(DESTDIR)$(docdir)/example"

uninstall-gnome-data:
	for p in $(icon_files); do                              \
	  file="$(DESTDIR)$(icondir)/`basename $$p`";           \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	for p in $(desktop_files); do                           \
	  file="$(DESTDIR)$(desktopdir)/`basename $$p`";        \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	-[ `basename $(icondir)` = $(PACKAGE) ] && rmdir "$(DESTDIR)$(icondir)"
	-[ `basename $(desktopdir)` = $(PACKAGE) ] && rmdir "$(DESTDIR)$(desktopdir)"

uninstall-conf:
	for p in $(conf_files); do                              \
	  file="$(DESTDIR)$(sysconfdir)/distcc/`basename $$p`"; \
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done
	-rmdir "$(DESTDIR)$(sysconfdir)/distcc"
	for p in $(default_files); do                           \
	  file="$(DESTDIR)$(sysconfdir)/default/`basename $$p`";\
	  if [ -e "$$file" ]; then rm -fv "$$file"; fi          \
	done

tags: $(SRC) $(HEADERS)
	ctags --defines --globals --typedefs-and-c++ --no-warn $(SRC) $(HEADERS)

TAGS: $(SRC) $(HEADERS)
	etags --declarations $(SRC) $(HEADERS)