File: Makefile.am

package info (click to toggle)
freetds 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 27,020 kB
  • sloc: ansic: 97,673; sh: 5,044; xml: 4,458; javascript: 2,911; sql: 1,474; makefile: 1,063; perl: 557; php: 22
file content (217 lines) | stat: -rw-r--r-- 7,078 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
# Converting DocBook to HTML (several small files)
# http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140

SHELL = /bin/sh
DOCDIR = .
TARGET_DOCDIR = $(DESTDIR)$(docdir)

EXTRA_DIST =	api_status.txt bcp.txt cap.txt getting_started.txt \
		policy.txt CodingStyle tds.html  \
		userguide.xsl userguide.xml userguide.css \
		$(man_MANS) \
		$(DOCDIR)/userguide $(DOCDIR)/reference \
		images grep_sample_code tds_ssl.html \
		freebcp.1.in tsql.1.in osql.1.in bsqldb.1.in bsqlodbc.1.in \
		defncopy.1.in datacopy.1.in fisql.1.in freetds.conf.5.in \
		userguide_desc.xml

man_MANS = 	freebcp.1 \
		tsql.1 \
		osql.1 \
		bsqldb.1 \
		bsqlodbc.1 \
		defncopy.1 \
		datacopy.1 \
		fisql.1 \
		freetds.conf.5

noinst_DATA	= $(DOCDIR)/reference/index.html $(DOCDIR)/userguide/index.html

$(DOCDIR)/userguide: $(DOCDIR)/userguide/index.html

$(DOCDIR)/reference: $(DOCDIR)/reference/index.html

doc:  $(DOCDIR)/userguide $(DOCDIR)/reference

dist:	man

man:	$(man_MANS)

INSTALLDIRS = 	$(TARGET_DOCDIR)/userguide    \
		$(TARGET_DOCDIR)/reference    \
		$(TARGET_DOCDIR)/images       \
		$(TARGET_DOCDIR)/images/callouts

$(INSTALLDIRS) $(DOCDIR):
	$(MKDIR_P) $@  2>&1

# If we built the documentation ourselves, install that, 
# else if we have access to distributed documentation, install that.  
install-data-local: $(INSTALLDIRS) $(noinst_DATA)
	$(MKDIR_P) $(DOCDIR) 2>&1
	if test -r $(DOCDIR)/userguide ; then d=.; else d="$(srcdir)"; fi; \
	find $$d/$(DOCDIR)/userguide \( -type f -o -type l \) \
		-exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/userguide ';'
	if test -r $(DOCDIR)/reference ; then d=.; else d="$(srcdir)"; fi; \
	find $$d/$(DOCDIR)/reference \( -type f -o -type l \) \
		-exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/reference ';'
	cd $(srcdir) && find images -name \*.gif \
		-exec  $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/{} ';'

uninstall-local:
	rm -rf $(TARGET_DOCDIR)

clean-local:
	rm -rf doxy.log \
		dblib.api.xml	\
		ctlib.api.xml	\
		 odbc.api.xml

## In building the UG and reference manual, we confront several
## possible situations:
## 1.  GIT user (or developer) with or without xmlto/doxygen installed.
## 2.  Distribution user.  The distribution includes pre-built
##     documentation, ready to install.
## Either of these users may choose to build out-of-tree (e.g., in a
## build/ directory).  We want to build the docs if we can, link to
## distributed ones if they exist, else create stub files pointing to
## the website.  
##
## We build the documentation only if we found xmlto.
## If the user builds FreeTDS out of tree, "make install" will put a symlink
## to the distributed UG HTML in the build directory, and install per usual.
##
## In the case of Doxygen, we detect its presence in the configure
## script, and invoke it if found.  If it is not found, we try to link
## the build tree's reference manual HTML to the distribution.  If
## that fails, we install a stub.

DISTRIBUTED_UG_DIR = $(srcdir)/$(DOCDIR)/userguide

UG_STUB = <html> \
	<P>at <a HREF="http://www.freetds.org/userguide/">www.freetds.org</a> \
	</html>

userguide_desc.xml: userguide.xml
	git log -1 '--pretty=format:<!-- Autogenerated -->%n<!ENTITY ug.date "Date: %ai">%n<!ENTITY ug.id "Git Id: %H">' HEAD -- $< > $@~
	mv -f $@~ $@

# To make the userguide, install xmlto
$(DOCDIR)/userguide/index.html: 	$(DOCDIR) userguide.xml userguide_desc.xml \
				dblib.api.xml ctlib.api.xml odbc.api.xml \
				userguide.xsl api_status.txt
	if test -h userguide; then rm userguide; fi
	$(MKDIR_P) $(DOCDIR)/userguide 2>&1
	touch $(DOCDIR)/userguide/t.htm
	rm -rf $(DOCDIR)/userguide/*
# if we're not using xmlto, copy the distribution's userguide
	if ! xmlto --version > /dev/null 2> /dev/null ; then \
		if test -r $(DISTRIBUTED_UG_DIR) \
		   -a ! -r $(DOCDIR)/userguide ; then \
			cp -R $(DISTRIBUTED_UG_DIR) $(DOCDIR); \
		fi; \
	fi
# try xmlto ...
	test -r $(abs_srcdir)/userguide.xml
	test -r userguide.xml || ln -s $(srcdir)/userguide.xml userguide.xml
	test -r userguide_desc.xml || ln -s $(srcdir)/userguide_desc.xml userguide_desc.xml
	(cd $(DOCDIR)/userguide && \
	if xmlto --version > /dev/null 2> /dev/null ; then \
		xmlto -m ../userguide.xsl xhtml ../userguide.xml; \
## 		and copy the stylesheet
		cp $(abs_srcdir)/userguide.css .; \
	fi)
# if still no joy, create a stub
	if test ! -r $@ ; then \
		echo '$(UG_STUB)' > .index.html && mv .index.html $@; \
	fi
	test -f $(DOCDIR)/userguide/index.html

userguide: $(DOCDIR)/userguide/index.html
reference: $(DOCDIR)/reference/index.html

DISTRIBUTED_REF_DIR = $(srcdir)/$(DOCDIR)/reference

REF_STUB = <html> \
	<P>at <a HREF="http://www.freetds.org/reference/">www.freetds.org</a> \
	</html>

$(DOCDIR)/reference/index.html: $(top_srcdir)/configure.ac
	if test -h reference; then rm reference; fi
	$(MKDIR_P) $(DOCDIR)/reference 2>&1
	cd .. && $(MAKE) doxy 2> doc/doxy.log
# If "make doxy" doesn't create anything, 
# try to copy the distributed manual's HTML
	if test -r $(DISTRIBUTED_REF_DIR)/index.html -a ! $@ ; then \
		cp -R $(DISTRIBUTED_REF_DIR) $(DOCDIR); \
	fi
# If we don't find the source, generate a stub.
	if test ! -r $@ ; then \
		cd $(DOCDIR)/reference && \
		echo '$(REF_STUB)' > .index.html &&  \
		mv .index.html index.html; \
	fi

#
# The following sections generate API implementation reference tables
# as XML "entities".
# The entities are used a little bit like include files in the UG, e.g.:  
#	<!ENTITY dblibapixml SYSTEM "../../../dblib.api.xml">
#
# and "dblibapixml" is referred to later on:
#	
#	<sect1 id="dblib.api.summary">
#		<title>db-lib API Implementation Summary</title>
#		&dblibapixml;
#	</sect1>
#
# This lets us use the api_status.txt document in our XML.
#
API_TABLE_HEADING = \
	<tgroup cols="4"><thead><row> \
		<entry>Category</entry> \
		<entry>Function</entry> \
		<entry>Status</entry> \
		<entry>Comments</entry> \
		</row></thead> 

API_FUNC_COL = <entry>Function</entry>
API_DBLIB_FUNC_COLS = <entry>Microsoft name</entry><entry>Sybase name</entry>

API_PAGE_FMT = \
	<table id="%s.api"> \
	<title>&%s; API Implementation Summary</title>\n \
	<!-- table heading -->\n \
		%s\n \
	<tbody>\n \
		%s\n \
	</tbody></tgroup></table>\n

dblib.api.body ctlib.api.body odbc.api.body: $(srcdir)/api_status.txt
	NAME=`echo $@ | sed 's/\..*$$//'` && \
	sed -ne "/^$${NAME}[	]/ s!!<row><entry>!p" \
			$(srcdir)/api_status.txt \
		| sed 	-e's![	][	]*!</entry> <entry>!g' \
			-e's!$$!</entry></row>!'  > $@~
	mv $@~ $@

dblib.api.xml: dblib.api.body
ctlib.api.xml: ctlib.api.body
odbc.api.xml: odbc.api.body

dblib.api.xml ctlib.api.xml odbc.api.xml:
	NAME=`echo $@ | sed 's/\..*$$//'` && \
	HEAD='$(API_TABLE_HEADING)' && \
	if [ $${NAME} = dblib ]; then \
		HEAD=`echo '$(API_TABLE_HEADING)' \
			| sed 's!$(API_FUNC_COL)!$(API_DBLIB_FUNC_COLS)!'`; \
	fi && \
	BODY=`cat $(@:.xml=.body)` && \
	printf '$(API_PAGE_FMT)' $${NAME} $${NAME} "$${HEAD}" "$${BODY}"  > $@~
	mv $@~ $@

CLEANFILES = dblib.api.body ctlib.api.body odbc.api.body dblib.api.xml ctlib.api.xml odbc.api.xml $(man_MANS)

distclean-local:
	rm -rf $(DOCDIR)/userguide $(DOCDIR)/reference