1##
2##  OSSP uuid - Universally Unique Identifier
3##  Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
4##  Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
5##
6##  This file is part of OSSP uuid, a library for the generation
7##  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
8##
9##  Permission to use, copy, modify, and distribute this software for
10##  any purpose with or without fee is hereby granted, provided that
11##  the above copyright notice and this permission notice appear in all
12##  copies.
13##
14##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
15##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
18##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
24##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25##  SUCH DAMAGE.
26##
27##  Makefile.in: make(1) build procedure
28##
29
30@SET_MAKE@
31
32VPATH       = @srcdir@
33srcdir      = @srcdir@
34top_srcdir  = @top_srcdir@
35S           = $(srcdir)
36C           = .
37
38DESTDIR     =
39prefix      = @prefix@
40exec_prefix = @exec_prefix@
41datarootdir = @datarootdir@
42bindir      = @bindir@
43libdir      = @libdir@
44includedir  = @includedir@
45mandir      = @mandir@
46
47CC          = @CC@
48CXX         = @CXX@
49CPPFLAGS    = -I. -I$(S) @CPPFLAGS@ @DEFS@
50CFLAGS      = @CFLAGS@
51CXXFLAGS    = @CXXFLAGS@
52LDFLAGS     = @LDFLAGS@
53LIBS        = @LIBS@
54RM          = rm -f
55CP          = cp
56RMDIR       = rmdir
57SHTOOL      = $(S)/shtool
58LIBTOOL     = $(C)/libtool
59TRUE        = true
60POD2MAN     = pod2man
61PERL        = @PERL@
62PHP         = @PHP@
63PG_CONFIG   = @PG_CONFIG@
64
65LIB_NAME    = libossp-uuid.la
66LIB_OBJS    = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_time.lo uuid_ui64.lo uuid_ui128.lo uuid_str.lo
67
68DCE_NAME    = libuuid_dce.la
69DCE_OBJS    = uuid_dce.lo $(LIB_OBJS)
70
71CXX_NAME    = libossp-uuid++.la
72CXX_OBJS    = uuid++.lo $(LIB_OBJS)
73
74PRG_NAME    = uuid
75PRG_OBJS    = uuid_cli.o
76
77MAN_NAME    = ossp-uuid.3 ossp-uuid++.3 uuid.1
78
79PERL_NAME   = $(S)/perl/blib/lib/OSSP/uuid.pm
80PERL_OBJS   = $(S)/perl/uuid.pm
81
82PHP_NAME    = $(S)/php/modules/uuid.so
83PHP_OBJS    = $(S)/php/uuid.c
84
85PGSQL_NAME  = $(S)/pgsql/libuuid.so
86PGSQL_OBJS  = $(S)/pgsql/uuid.c
87
88TARGETS     = $(LIB_NAME) @DCE_NAME@ @CXX_NAME@ $(PRG_NAME) @PERL_NAME@ @PHP_NAME@ @PGSQL_NAME@
89
90WITH_DCE         = @WITH_DCE@
91WITH_CXX         = @WITH_CXX@
92WITH_PERL        = @WITH_PERL@
93WITH_PERL_COMPAT = @WITH_PERL_COMPAT@
94WITH_PHP         = @WITH_PHP@
95WITH_PGSQL       = @WITH_PGSQL@
96
97.SUFFIXES:
98.SUFFIXES: .c .cc .o .lo
99
100all: $(TARGETS)
101
102.c.o:
103	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
104
105.cc.o:
106	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
107
108.c.lo:
109	@$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
110
111.cc.lo:
112	@$(LIBTOOL) --mode=compile $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
113
114$(LIB_NAME): $(LIB_OBJS)
115	@$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \
116	    -version-info `$(SHTOOL) version -l c -d libtool $(S)/uuid_vers.h`
117
118$(DCE_NAME): $(DCE_OBJS)
119	@$(LIBTOOL) --mode=link $(CC) -o $(DCE_NAME) $(DCE_OBJS) -rpath $(libdir) \
120	    -version-info `$(SHTOOL) version -l c -d libtool $(S)/uuid_vers.h`
121
122$(CXX_NAME): $(CXX_OBJS)
123	@$(LIBTOOL) --mode=link $(CXX) -o $(CXX_NAME) $(CXX_OBJS) -rpath $(libdir) \
124	    -version-info `$(SHTOOL) version -l c -d libtool $(S)/uuid_vers.h`
125
126$(PRG_NAME): $(PRG_OBJS) $(LIB_NAME)
127	@$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(PRG_NAME) $(PRG_OBJS) $(LIB_NAME) $(LIBS)
128
129$(PERL_NAME): $(PERL_OBJS) $(LIB_NAME)
130	@cd $(S)/perl && $(PERL) Makefile.PL PREFIX=$(prefix) COMPAT=$(WITH_PERL_COMPAT) && $(MAKE) $(MFLAGS) all
131	@touch $(PERL_NAME)
132
133$(PHP_NAME): $(PHP_OBJS) $(LIB_NAME)
134	@cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local PHP=$(PHP)
135	@touch $(PHP_NAME)
136
137$(PGSQL_NAME): $(PGSQL_OBJS) $(LIB_NAME)
138	@cd $(S)/pgsql && $(MAKE) $(MFLAGS) PG_CONFIG=$(PG_CONFIG)
139	@touch $(PGSQL_NAME)
140
141uuid.lo: $(S)/uuid.c uuid.h $(S)/uuid_md5.h $(S)/uuid_sha1.h $(S)/uuid_prng.h $(S)/uuid_mac.h $(S)/uuid_ui64.h $(S)/uuid_ui128.h $(S)/uuid_str.h $(S)/uuid_bm.h $(S)/uuid_ac.h
142uuid_mac.lo: $(S)/uuid_mac.c $(S)/uuid_mac.h
143uuid_md5.lo: $(S)/uuid_md5.c $(S)/uuid_md5.h
144uuid_sha1.lo: $(S)/uuid_sha1.c $(S)/uuid_sha1.h
145uuid_prng.lo: $(S)/uuid_prng.c $(S)/uuid_prng.h
146uuid_str.lo: $(S)/uuid_str.c $(S)/uuid_str.h
147uuid_ui64.lo: $(S)/uuid_ui64.c $(S)/uuid_ui64.h
148uuid_ui128.lo: $(S)/uuid_ui64.c $(S)/uuid_ui128.h
149uuid_dce.lo: $(S)/uuid_dce.c uuid.h $(S)/uuid_dce.h
150uuid_cli.o: $(S)/uuid_cli.c uuid.h
151uuid++.lo: $(S)/uuid++.cc $(S)/uuid++.hh
152
153man: uuid.3 uuid++.3 uuid-config.1 uuid.1
154uuid.3: uuid.pod
155	V1=`$(SHTOOL) version -l c -d short $(S)/uuid_vers.h`; \
156	V2=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h`; \
157	D=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \
158	$(POD2MAN) --quotes=none \
159	           --section=3 --center="Universally Unique Identifier" \
160	           --release="$$D" --date="OSSP uuid $$V1" $(S)/uuid.pod | \
161	sed -e "s;UUID_VERSION_STR;$$V2;" >uuid.3
162uuid++.3: uuid++.pod
163	V1=`$(SHTOOL) version -l c -d short $(S)/uuid_vers.h`; \
164	V2=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h`; \
165	D=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \
166	$(POD2MAN) --quotes=none \
167	           --section=3 --center="Universally Unique Identifier" \
168	           --release="$$D" --date="OSSP uuid $$V1" $(S)/uuid++.pod | \
169	sed -e "s;UUID_VERSION_STR;$$V2;" >uuid++.3
170uuid-config.1: uuid-config.pod
171	V1=`$(SHTOOL) version -l c -d short $(S)/uuid_vers.h`; \
172	V2=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h`; \
173	D=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \
174	$(POD2MAN) --quotes=none \
175	           --section=1 --center="Universally Unique Identifier" \
176	           --release="$$D" --date="OSSP uuid $$V1" $(S)/uuid-config.pod | \
177	sed -e "s;UUID_VERSION_STR;$$V2;" >uuid-config.1
178uuid.1: uuid_cli.pod
179	V1=`$(SHTOOL) version -l c -d short $(S)/uuid_vers.h`; \
180	V2=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h`; \
181	D=`$(SHTOOL) version -l c -d long $(S)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \
182	$(CP) $(S)/uuid_cli.pod /tmp/uuid.pod; \
183	$(POD2MAN) --quotes=none \
184	           --section=1 --center="Universally Unique Identifier" \
185	           --release="$$D" --date="OSSP uuid $$V1" /tmp/uuid.pod | \
186	sed -e "s;UUID_VERSION_STR;$$V2;" >uuid.1; \
187	$(RM) /tmp/uuid.pod
188
189check: all
190	@echo "==== UUID version 1 (time and node based): 4 single iterations"; \
191	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -n 4 -1
192	@echo "==== UUID version 1 (time and node based): 4 subsequent iterations"; \
193	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -n 4
194	@echo "==== UUID version 3 (name based, MD5): 2 times repeated"; \
195	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v3 -n 2 ns:URL http://www.ossp.org/
196	@echo "==== UUID version 5 (name based, SHA-1): 2 times repeated"; \
197	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v5 -n 2 ns:URL http://www.ossp.org/
198	@echo "==== UUID version 4 (random data based): 4 single iterations"; \
199	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4 -n 4 -1
200	@echo "==== UUID version 4 (random data based): 4 subsequent iterations"; \
201	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4 -n 4
202	@echo "==== UUID version 1 generation and decoding"; \
203	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1`; \
204	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -m`
205	@echo "==== UUID version 3 generation and decoding"; \
206	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v3 ns:URL http://www.ossp.org/`
207	@echo "==== UUID version 5 generation and decoding"; \
208	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v5 ns:URL http://www.ossp.org/`
209	@echo "==== UUID version 3 generation and decoding"; \
210	$(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4`
211	-@if [ ".$(WITH_PERL)" = .yes ]; then \
212	    echo "==== Perl bindings to C API"; \
213	    (cd $(S)/perl && $(MAKE) $(MFLAGS) test); \
214	fi
215	-@if [ ".$(WITH_PHP)" = .yes ]; then \
216	    echo "==== PHP bindings to C API"; \
217	    (cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local test PHP=$(PHP)); \
218	fi
219	-@if [ ".$(WITH_PGSQL)" = .yes ]; then \
220	    echo "==== PGSQL bindings to C API"; \
221	    (cd $(S)/pgsql && $(MAKE) $(MFLAGS) test PG_CONFIG=$(PG_CONFIG)); \
222	fi
223
224.PHONY: install
225install:
226	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)
227	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir)
228	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(includedir)
229	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)/libdata/pkgconfig
230	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man3
231	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man1
232	$(SHTOOL) install -c -m 755 uuid-config $(DESTDIR)$(bindir)/
233	$(SHTOOL) install -c -m 644 $(S)/uuid-config.1 $(DESTDIR)$(mandir)/man1/
234	$(SHTOOL) install -c -m 644 $(S)/uuid.pc $(DESTDIR)$(prefix)/libdata/pkgconfig/ossp-uuid.pc
235	$(SHTOOL) install -c -m 644 uuid.h $(DESTDIR)$(includedir)/
236	-@if [ ".$(WITH_DCE)" = .yes ]; then \
237	    echo "$(SHTOOL) install -c -m 644 $(S)/uuid_dce.h $(DESTDIR)$(includedir)/"; \
238	    $(SHTOOL) install -c -m 644 $(S)/uuid_dce.h $(DESTDIR)$(includedir)/; \
239	fi
240	-@if [ ".$(WITH_CXX)" = .yes ]; then \
241	    echo "$(SHTOOL) install -c -m 644 $(S)/uuid++.hh $(DESTDIR)$(includedir)/"; \
242	    $(SHTOOL) install -c -m 644 $(S)/uuid++.hh $(DESTDIR)$(includedir)/; \
243	fi
244	$(SHTOOL) install -c -m 644 $(S)/uuid.3 $(DESTDIR)$(mandir)/man3/ossp-uuid.3
245	-@if [ ".$(WITH_CXX)" = .yes ]; then \
246	    echo "$(SHTOOL) install -c -m 644 $(S)/uuid++.3 $(DESTDIR)$(mandir)/man3/ossp-uuid++.3"; \
247	    $(SHTOOL) install -c -m 644 $(S)/uuid++.3 $(DESTDIR)$(mandir)/man3/ossp-uuid++.3; \
248	fi
249	@$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 $(LIB_NAME) $(DESTDIR)$(libdir)/
250	-@if [ ".$(WITH_DCE)" = .yes ]; then \
251	    $(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 $(DCE_NAME) $(DESTDIR)$(libdir)/; \
252	fi
253	-@if [ ".$(WITH_CXX)" = .yes ]; then \
254	    $(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 $(CXX_NAME) $(DESTDIR)$(libdir)/; \
255	fi
256	@$(LIBTOOL) --mode=install $(SHTOOL) install -c -s -m 755 uuid $(DESTDIR)$(bindir)/
257	$(SHTOOL) install -c -m 644 $(S)/uuid.1 $(DESTDIR)$(mandir)/man1/
258	-@if [ ".$(WITH_PERL)" = .yes ]; then \
259	    (cd $(S)/perl && $(MAKE) $(MFLAGS) install DESTDIR=$(DESTDIR)); \
260	fi
261	-@if [ ".$(WITH_PHP)" = .yes ]; then \
262	    (cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local install EXTDIR=$(prefix)/lib/php PHP=$(PHP) DESTDIR=$(DESTDIR)); \
263	fi
264	-@if [ ".$(WITH_PGSQL)" = .yes ]; then \
265	    (cd $(S)/pgsql && $(MAKE) $(MFLAGS) install DESTDIR=$(DESTDIR) PG_CONFIG=$(PG_CONFIG)); \
266	fi
267
268.PHONY: uninstall
269uninstall:
270	-$(RM) $(DESTDIR)$(mandir)/man1/uuid.1
271	-@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(bindir)/uuid
272	-@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/$(LIB_NAME)
273	-@if [ ".$(WITH_DCE)" = .yes ]; then \
274	    $(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/$(DCE_NAME); \
275	fi
276	-@if [ ".$(WITH_CXX)" = .yes ]; then \
277	    $(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/$(CXX_NAME); \
278	fi
279	-$(RM) $(DESTDIR)$(mandir)/man3/uuid.3
280	-@if [ ".$(WITH_CXX)" = .yes ]; then \
281	    echo "$(RM) $(DESTDIR)$(mandir)/man3/uuid++.3"; \
282	    $(RM) $(DESTDIR)$(mandir)/man3/uuid++.3; \
283	fi
284	-$(RM) $(DESTDIR)$(includedir)/uuid.h
285	-@if [ ".$(WITH_DCE)" = .yes ]; then \
286	    echo "$(RM) $(DESTDIR)$(includedir)/uuid_dce.h"; \
287	    $(RM) $(DESTDIR)$(includedir)/uuid_dce.h; \
288	fi
289	-@if [ ".$(WITH_CXX)" = .yes ]; then \
290	    echo "$(RM) $(DESTDIR)$(includedir)/uuid++.hh"; \
291	    $(RM) $(DESTDIR)$(includedir)/uuid++.hh; \
292	fi
293	-$(RM) $(DESTDIR)$(prefix)/libdata/pkgconfig/uuid.pc
294	-$(RM) $(DESTDIR)$(mandir)/man1/uuid-config.1
295	-$(RM) $(DESTDIR)$(bindir)/uuid-config
296	-$(RMDIR) $(DESTDIR)$(mandir)/man1 >/dev/null 2>&1 || $(TRUE)
297	-$(RMDIR) $(DESTDIR)$(mandir)/man3 >/dev/null 2>&1 || $(TRUE)
298	-$(RMDIR) $(DESTDIR)$(mandir) >/dev/null 2>&1 || $(TRUE)
299	-$(RMDIR) $(DESTDIR)$(prefix)/libdata/pkgconfig >/dev/null 2>&1 || $(TRUE)
300	-$(RMDIR) $(DESTDIR)$(libdir) >/dev/null 2>&1 || $(TRUE)
301	-$(RMDIR) $(DESTDIR)$(includedir) >/dev/null 2>&1 || $(TRUE)
302	-$(RMDIR) $(DESTDIR)$(bindir) >/dev/null 2>&1 || $(TRUE)
303	-$(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE)
304
305.PHONY: clean
306clean:
307	-$(RM) $(LIB_NAME) $(LIB_OBJS)
308	-@if [ ".$(WITH_DCE)" = .yes ]; then \
309	    echo "$(RM) $(DCE_NAME) $(DCE_OBJS)"; \
310	    $(RM) $(DCE_NAME) $(DCE_OBJS); \
311	fi
312	-@if [ ".$(WITH_CXX)" = .yes ]; then \
313	    echo "$(RM) $(CXX_NAME) $(CXX_OBJS)"; \
314	    $(RM) $(CXX_NAME) $(CXX_OBJS); \
315	fi
316	-$(RM) $(PRG_NAME) $(PRG_OBJS)
317	-$(RM) -r .libs >/dev/null 2>&1 || $(TRUE)
318	-$(RM) *.o *.lo
319	-@if [ ".$(WITH_PERL)" = .yes ]; then \
320	    (cd $(S)/perl && $(MAKE) $(MFLAGS) clean || true); \
321	fi
322	-@if [ ".$(WITH_PHP)" = .yes ]; then \
323	    (cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local clean || true); \
324	fi
325	-@if [ ".$(WITH_PGSQL)" = .yes ]; then \
326	    (cd $(S)/pgsql && $(MAKE) $(MFLAGS) clean PG_CONFIG=$(PG_CONFIG) || true); \
327	fi
328
329distclean: clean
330	-$(RM) config.log config.status config.cache
331	-$(RM) Makefile config.h uuid-config uuid.h uuid.pc
332	-$(RM) libtool
333	-@if [ ".$(WITH_PERL)" = .yes ]; then \
334	    (cd $(S)/perl && $(MAKE) $(MFLAGS) distclean || true; rm -f Makefile.old); \
335	fi
336	-@if [ ".$(WITH_PHP)" = .yes ]; then \
337	    (cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local distclean || true); \
338	fi
339	-@if [ ".$(WITH_PGSQL)" = .yes ]; then \
340	    (cd $(S)/pgsql && $(MAKE) $(MFLAGS) distclean PG_CONFIG=$(PG_CONFIG) || true); \
341	fi
342
343realclean: distclean
344	-$(RM) uuid.3 uuid.1
345	-$(RM) configure config.h.in
346	-$(RM) shtool
347	-$(RM) ltmain.sh libtool.m4 config.guess config.sub
348	-@if [ ".$(WITH_PERL)" = .yes ]; then \
349	    (cd $(S)/perl && $(MAKE) $(MFLAGS) realclean || true; rm -f Makefile.old); \
350	fi
351	-@if [ ".$(WITH_PHP)" = .yes ]; then \
352	    (cd $(S)/php && $(MAKE) $(MFLAGS) -f Makefile.local realclean || true); \
353	fi
354	-@if [ ".$(WITH_PGSQL)" = .yes ]; then \
355	    (cd $(S)/pgsql && $(MAKE) $(MFLAGS) realclean PG_CONFIG=$(PG_CONFIG) || true); \
356	fi
357
358