summaryrefslogtreecommitdiff
path: root/source4/Makefile.in
blob: e240afb7666a9c112c00a4a4964bc639459d7005 (plain)
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
#########################################################################
# Makefile.in for Samba - rewritten for autoconf support
# Copyright Andrew Tridgell 1992-2003
# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
# Copyright (C) 2002 Andrew Bartlett <abartlet@samba.org>
# Copyright (C) 2003 Anthony Liguori <aliguor@us.ibm.com>
# Copyright (C) 2003 James Myers <myersjj@samba.org>
# Copyright (C) 2002-2003 Jelmer Vernooij <jelmer@samba.org>
# Copyright (C) 2004 Stefan Metzmacher <metze@samba.org>
###########################################################################

prefix=@prefix@
exec_prefix=@exec_prefix@

LIBS=@LIBS@ @LDAP_LIBS@ @KRB5_LIBS@ @LIBPOPT_LIBS@
CC=@CC@
SHLD=@SHLD@
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
LDSHFLAGS=@LDSHFLAGS@ @LDFLAGS@ @CFLAGS@
PERL=@PERL@
DYNEXP=@DYNEXP@

VPATH=@srcdir@
srcdir=@srcdir@
builddir=@builddir@
SHELL=/bin/sh

BASEDIR= @prefix@
BINDIR = @bindir@
SBINDIR = @sbindir@
LIBDIR = @libdir@
CONFIGDIR = @configdir@
VARDIR = @localstatedir@

# The permissions to give the executables
INSTALLPERMS = 0755

# set these to where to find various files
# These can be overridden by command line switches (see smbd(8))
# or in smb.conf (see smb.conf(5))
LOGFILEBASE = @logfilebase@
CONFIGFILE = $(CONFIGDIR)/smb.conf
LMHOSTSFILE = $(CONFIGDIR)/lmhosts

# This is where smbpasswd et al go
PRIVATEDIR = @privatedir@
SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd

# the directory where lock files go
LOCKDIR = @lockdir@

# the directory where pid files go
PIDDIR = @piddir@

FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include $(CPPFLAGS) -I. -I$(srcdir)
FLAGS32 =

PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\"  -DSBINDIR=\"$(SBINDIR)\"
PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" 
PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" 
PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
	      -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)

# Note that all executable programs now provide for an optional executable suffix.

SBIN_PROGS = bin/smbd@EXEEXT@

BIN_PROGS = bin/smbclient@EXEEXT@ 

TORTURE_PROGS = bin/smbtorture@EXEEXT@ \
		bin/gentest@EXEEXT@ \
		bin/locktest@EXEEXT@ \
		bin/masktest@EXEEXT@ \
		bin/ndrdump@EXEEXT@

CHARSET_MODULES = @CHARSET_MODULES@
CHARSET_LIBDIR = $(LIBDIR)/charset
DCERPC_MODULES = @DCERPC_MODULES@
DCERPC_LIBDIR = $(LIBDIR)/dcerpc
NTVFS_MODULES = @NTVFS_MODULES@
NTVFS_LIBDIR = $(LIBDIR)/ntvfs

MODULES = $(CHARSET_MODULES) $(DCERPC_MODULES) $(NTVFS_MODULES)

######################################################################
# object file lists
######################################################################

CHARSET_OBJS = @CHARSET_OBJS@

LIBBASIC_OBJS = @LIBBASIC_OBJS@
LIBBASIC_LIBS = @LIBBASIC_LIBS@ $(LIBS)

LIBCLI_RAW_OBJS = @LIBCLI_RAW_OBJS@
LIBCLI_UTILS_OBJS = @LIBCLI_UTILS_OBJS@
LIBCLI_NMB_OBJS = @LIBCLI_NMB_OBJS@
LIBCLI_AUTH_OBJS = @LIBCLI_AUTH_OBJS@
LIBCLI_OBJS = @LIBCLI_OBJS@

LIBNDR_RAW_OBJS = @LIBNDR_RAW_OBJS@
LIBRPC_RAW_OBJS = @LIBRPC_RAW_OBJS@
LIBRPC_OBJS = @LIBRPC_OBJS@

LIBSMB_OBJS = @LIBSMB_OBJS@
LIBSMB_LIBS = @LIBSMB_LIBS@

LIBPOPT_OBJS = @LIBPOPT_OBJS@
LIBPOPT_LIBS = @LIBPOPT_LIBS@

LIBCMDLINE_OBJS = @LIBCMDLINE_OBJS@ $(LIBPOPT_OBJS)
LIBCMDLINE_LIBS = @LIBCMDLINE_LIBS@ $(LIBPOPT_LIBS)

CONFIG_OBJS = @CONFIG_OBJS@
CONFIG_LIBS = @CONFIG_LIBS@

PROCESS_MODEL_OBJS = @PROCESS_MODEL_OBJS@
PROCESS_MODEL_LIBS = @PROCESS_MODEL_LIBS@

SMB_OBJS = @SMB_OBJS@
SMB_LIBS = @SMB_LIBS@

AUTH_OBJS = @AUTH_OBJS@
AUTH_LIBS = @AUTH_LIBS@

PASSDB_OBJS = @PASSDB_OBJS@
PASSDB_LIBS = @PASSDB_LIBS@

NTVFS_OBJS = @NTVFS_OBJS@
NTVFS_LIBS = @NTVFS_LIBS@

DCERPC_OBJS = @DCERPC_OBJS@
DCERPC_LIBS = @DCERPC_LIBS@

TORTURE_RAW_OBJS = @TORTURE_RAW_OBJS@

TORTURE_RPC_OBJS = @TORTURE_RPC_OBJS@

TORTURE_NBENCH_OBJS = @TORTURE_NBENCH_OBJS@

TORTURE_OBJS = @TORTURE_OBJS@
TORTURE_LIBS = @TORTURE_LIBS@

CLIENT_OBJS = client/client.o client/clitar.o libcli/raw/clirewrite.o
CLIENT_LIBS =

SERVER_OBJS = 	smbd/server.o smbd/process.o \
		lib/server_mutex.o \
		smbd/build_options.o \
		smbd/rewrite.o
SERVER_LIBS =

SMBD_OBJS =	$(SERVER_OBJS) $(PROCESS_MODEL_OBJS) \
		$(DCERPC_OBJS) $(SMB_OBJS) $(AUTH_OBJS) $(PASSDB_OBJS) $(NTVFS_OBJS) \
		$(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS)
SMBD_LIBS = 	$(SERVER_LIBS) $(PROCESS_MODEL_LIBS) \
		$(DCERPC_LIBS) $(SMB_LIBS) $(AUTH_LIBS) $(PASSDB_LIBS) $(NTVFS_LIBS) \
		$(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS)

SMBCLIENT_OBJS = $(CLIENT_OBJS) $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) $(LIBCMDLINE_OBJS)
SMBCLIENT_LIBS = $(CLIENT_LIBS) $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) $(LIBCMDLINE_LIBS)

SMBTORTURE_OBJS = $(TORTURE_OBJS) $(CONFIG_OBJS) $(LIBSMB_OBJS) $(LIBBASIC_OBJS)
SMBTORTURE_LIBS = $(TORTURE_LIBS) $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS)

GENTEST_OBJS = torture/gentest.o torture/torture_util.o libcli/raw/clirewrite.o \
		$(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS)
GENTEST_LIBS =	$(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS)

MASKTEST_OBJS = torture/masktest.o libcli/raw/clirewrite.o \
		$(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS)
MASKTEST_LIBS =	$(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS)

LOCKTEST_OBJS = torture/locktest.o libcli/raw/clirewrite.o \
		$(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS)
LOCKTEST_LIBS =	$(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS)

NDRDUMP_OBJS = utils/ndrdump.o utils/rewrite.o \
		$(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS)
NDRDUMP_LIBS =	$(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS)

PROTO_OBJ = 	$(SERVER_OBJS) $(PROCESS_MODEL_OBJS) $(CLIENT_OBJS) $(TORTURE_OBJS) \
		$(DCERPC_OBJS) $(SMB_OBJS) $(AUTH_OBJS) $(PASSDB_OBJS) $(NTVFS_OBJS) \
		$(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS)

######################################################################
# now the rules...
######################################################################
all: SHOWFLAGS $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) $(MODULES)

torture : SHOWFLAGS $(TORTURE_PROGS)

smbtorture : SHOWFLAGS bin/smbtorture@EXEEXT@

gentest: SHOWFLAGS bin/gentest@EXEEXT@

masktest : SHOWFLAGS bin/masktest@EXEEXT@

locktest : SHOWFLAGS bin/locktest@EXEEXT@

modules: SHOWFLAGS proto_exists $(MODULES)

everything: all

.SUFFIXES:
.SUFFIXES: .c .o .po .po32 .lo

SHOWFLAGS: basics
	@echo "Using FLAGS = $(FLAGS)"
	@echo "      FLAGS32 = $(FLAGS32)"
	@echo "      LIBS = $(LIBS)"
	@echo "      LDSHFLAGS = $(LDSHFLAGS)"
	@echo "      LDFLAGS = $(LDFLAGS)"

MAKEDIR = || exec false; \
	  if test -d "$$dir"; then :; else \
	  echo mkdir "$$dir"; \
	  mkdir -p "$$dir" >/dev/null 2>&1 || \
	  test -d "$$dir" || \
	  mkdir "$$dir" || \
	  exec false; fi || exec false

.c.o:
	@echo Compiling $*.c
	@$(CC) -I. -I$(srcdir) $(FLAGS) -c $< \
	  -o $@ 
@BROKEN_CC@	-mv `echo $@ | sed 's%^.*/%%g'` $@

# 'make pch' is extremely useful for fast compiles if you have gcc-3.4
pch: basics
	rm -f $(srcdir)/include/includes.h.gch
	$(CC) -I. -I$(srcdir) $(FLAGS) -c $(srcdir)/include/includes.h -o $(srcdir)/include/includes.h.gch


idl_full: build/pidl/idl.pm
	CPP="@CPP@" script/build_idl.sh FULL

idl: build/pidl/idl.pm
	@CPP="@CPP@" script/build_idl.sh

basics: idl proto_test

build/pidl/idl.pm: build/pidl/idl.yp
	-yapp -s build/pidl/idl.yp

# These dependencies are only approximately correct: we want to make
# sure Samba's paths are updated if ./configure is re-run.  Really it
# would be nice if "make prefix=/opt/samba all" also rebuilt things,
# but since we also require "make install prefix=/opt/samba" *not* to
# rebuild it's a bit hard.

dynconfig.o: dynconfig.c Makefile
	@echo Compiling $*.c
	@$(CC) $(FLAGS) $(PATH_FLAGS) -c $< -o $@ 

dynconfig.po: dynconfig.c Makefile
	@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
	  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
	@echo Compiling $*.c with @PICFLAG@
	@$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@
@BROKEN_CC@	-mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@
@POBAD_CC@	@mv $*.po.o $@

lib/version.o: lib/version.c include/version.h
	@echo Compiling $*.c
	@$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) -c $< -o $@ 

lib/version.po: lib/version.c include/version.h
	@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
	  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
	@echo Compiling $*.c with @PICFLAG@
	@$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@
@BROKEN_CC@	-mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@
@POBAD_CC@	@mv $*.po.o $@

.c.po: 
	@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
	  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
	@echo Compiling $*.c with @PICFLAG@
	@$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@
@BROKEN_CC@	-mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@
@POBAD_CC@	@mv $*.po.o $@

# this is for IRIX
.c.po32: 
	@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
	  dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
	@echo Compiling $*.c with @PICFLAG@ and -32
	@$(CC) -32 -I. -I$(srcdir) $(FLAGS32) $(PATH_FLAGS) @PICFLAG@ -c $< \
	  -o $*.po32.o 
@BROKEN_CC@	-mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po32$$%.o%'` $@.o
	@mv $*.po32.o $@

bin/.dummy:
	@if (: >> $@ || : > $@) >/dev/null 2>&1; then :; else \
	  dir=bin $(MAKEDIR); fi
	@: >> $@ || : > $@ # what a fancy emoticon!

bin/smbd@EXEEXT@: $(SMBD_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(SMBD_OBJS) $(LDFLAGS) $(DYNEXP) $(SMBD_LIBS)

bin/smbclient@EXEEXT@: $(SMBCLIENT_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(SMBCLIENT_OBJS) $(LDFLAGS) $(SMBCLIENT_LIBS)

bin/smbtorture@EXEEXT@: $(SMBTORTURE_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJS) $(LDFLAGS) $(SMBTORTURE_LIBS)

bin/ndrdump@EXEEXT@: $(NDRDUMP_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(NDRDUMP_OBJS) $(LDFLAGS) $(NDRDUMP_LIBS)

bin/gentest@EXEEXT@: $(GENTEST_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(GENTEST_OBJS) $(LDFLAGS) $(GENTEST_LIBS)

bin/masktest@EXEEXT@: $(MASKTEST_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJS) $(LDFLAGS) $(MASKTEST_LIBS)

bin/locktest@EXEEXT@: $(LOCKTEST_OBJS) bin/.dummy
	@echo Linking $@
	@$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJS) $(LDFLAGS) $(LOCKTEST_LIBS)

install: installbin installtorture installdat 

# DESTDIR is used here to prevent packagers wasting their time
# duplicating the Makefile. Remove it and you will have the privelege
# of package each samba release for muliple versions of multiple
# distributions and operating systems, or at least supplying patches
# to all the packaging files required for this, prior to committing
# the removal of DESTDIR. Do not remove it even though you think it
# is not used

installdirs:
	@$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR)
	@$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DESTDIR)$(NTVFS_LIBDIR)

installservers: all installdirs
	@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)

installbin: all installdirs
	@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
	@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)

installtorture: all installdirs
	@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS)

installmodules: all installdirs
	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(NTVFS_LIBDIR) $(NTVFS_MODULES)
	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DCERPC_MODULES)
	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(CHARSET_MODULES)

installdat: installdirs
	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)

# revert to the previously installed version
revert:
	@$(SHELL) $(srcdir)/script/revert.sh $(SBINDIR) $(SBIN_PROGS)

.PHONY: showlayout

showlayout: 
	@echo "Samba will be installed into:"
	@echo "  basedir: $(BASEDIR)"
	@echo "  bindir:  $(BINDIR)"
	@echo "  sbindir: $(SBINDIR)"
	@echo "  libdir:  $(LIBDIR)"
	@echo "  vardir:  $(VARDIR)"

uninstall: uninstallbin uninstalltorture

uninstallbin:
	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)

uninstalltorture:
	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)

uninstallmodules:
	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(NTVFS_LIBDIR) $(DESTDIR)$(NTVFS_MODULES)
	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DESTDIR)$(DCERPC_MODULES)
	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(DESTDIR)$(CHARSET_MODULES)

# Toplevel clean files
TOPFILES=dynconfig.o dynconfig.po

clean: delheaders
	-rm -f core */*~ *~ */*.o */*/*.o */*/*.po */*/*.po32 */*.po */*.po32 */*.@SHLIBEXT@ \
		$(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(MODULES) $(TORTURE_PROGS) \
		.headers.stamp 
	-rm -rf librpc/gen_*

# Making this target will just make sure that the prototype files
# exist, not necessarily that they are up to date.  Since they're
# removed by "make clean" this will always be run when you do anything
# afterwards.
proto_exists: include/proto.h include/build_env.h

delheaders:
	@/bin/rm -f $(srcdir)/include/proto.h $(srcdir)/include/build_env.h 

include/proto.h:
	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(PERL) \
	  -h _PROTO_H_ $(builddir)/include/proto.h \
	  $(PROTO_OBJ)

include/build_env.h:
	@echo Building include/build_env.h
	@cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h

# "make headers" or "make proto" calls a subshell because we need to
# make sure these commands are executed in sequence even for a
# parallel make.
headers: delheaders include/proto.h include/build_env.h 

proto: idl headers 

proto_test:
	@[ -f include/proto.h ] || $(MAKE) proto

.PHONY: headers proto

etags:
	etags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/`

ctags:
	ctags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/`

realclean: clean delheaders
	-rm -f config.log bin/.dummy

distclean: realclean
	-rm -f include/config.h Makefile
	-rm -f config.status config.cache

realdistclean: distclean
	-rm -f include/config.h.in
	-rm -f lib/version.h
	-rm -f configure

# when configure.in is updated, reconfigure
$(srcdir)/configure: $(srcdir)/configure.in
	@echo "WARNING: you need to rerun ./autogen.sh"

config.status: $(srcdir)/configure
	@echo "WARNING: you need to run configure"

Makefile: $(srcdir)/Makefile.in config.status
	@echo "WARNING: you need to run ./config.status"