Smake: Use glibtoolize instead of libtoolize, if it is available.
[pspp] / Smake
1 # -*- makefile -*-
2
3 # Adjust these to reflect where you've installed gnulib.
4 GNULIB = ../gnulib
5 GNULIB_TOOL = $(GNULIB)/gnulib-tool
6
7 GNULIB_MODULES = \
8         assert \
9         byteswap \
10         c-snprintf \
11         c-strcase \
12         c-strcasestr \
13         c-ctype \
14         c-strtod \
15         c-xvasprintf \
16         clean-temp \
17         close \
18         configmake \
19         count-one-bits \
20         crc \
21         crypto/md4 \
22         crypto/md5 \
23         dirname \
24         dtoastr \
25         environ \
26         fatal-signal \
27         fcntl \
28         fpieee \
29         fprintf-posix \
30         full-read \
31         full-write \
32         fseeko \
33         ftello \
34         fwriteerror \
35         getline \
36         gettext \
37         gettimeofday \
38         getopt-gnu \
39         gitlog-to-changelog \
40         include_next \
41         isfinite \
42         isinf \
43         isnan \
44         intprops \
45         inttostr \
46         localcharset \
47         mbchar \
48         mbiter \
49         memcasecmp \
50         memchr \
51         memchr2 \
52         mempcpy \
53         memrchr \
54         minmax \
55         mkdtemp \
56         mkstemp \
57         pipe2 \
58         printf-posix \
59         printf-safe \
60         progname \
61         rawmemchr \
62         read-file \
63         regex \
64         relocatable-prog \
65         rename \
66         round \
67         select \
68         snprintf \
69         snprintf-posix \
70         sprintf-posix \
71         stdarg \
72         stdbool \
73         stdint \
74         strcasestr \
75         stpcpy \
76         strerror \
77         strftime \
78         strtod \
79         strtok_r \
80         sys_stat \
81         tempname \
82         trunc \
83         unicase/u8-casecmp \
84         unicase/u8-casefold \
85         unicase/u8-tolower \
86         unicase/u8-toupper \
87         unictype/ctype-print \
88         unictype/category-of \
89         unigbrk/uc-is-grapheme-break \
90         unilbrk/u8-possible-linebreaks \
91         uninorm/nfkd \
92         unistd \
93         unistr/u8-check \
94         unistr/u8-cpy \
95         unistr/u8-mblen \
96         unistr/u8-mbtouc \
97         unistr/u8-mbtoucr \
98         unistr/u8-strlen \
99         unistr/u8-strmbtouc \
100         unistr/u8-strncat \
101         unistr/u8-uctomb \
102         uniwidth/u8-strwidth \
103         unitypes \
104         unlocked-io \
105         vasprintf-posix \
106         version-etc \
107         version-etc-fsf \
108         vfprintf-posix \
109         vprintf-posix \
110         vsnprintf \
111         vsnprintf-posix \
112         vsprintf-posix \
113         xalloc \
114         xalloc-die \
115         xmalloca \
116         xmemdup0 \
117         xsize \
118         xstrndup \
119         xvasprintf
120
121 all: prep_ph
122         $(MAKE) -f Smake Makefile.in configure
123
124 .PHONY: prep_ph
125 prep_ph: 
126         test -e ChangeLog || touch ChangeLog
127         test -d m4 || mkdir m4
128         touch m4/Makefile.am
129         $(GNULIB_TOOL) --add-import --no-changelog --m4-base=gl/m4 \
130                 --source-base=gl --lib=libgl --tests-base=tests \
131                 --doc-base=gl/doc --aux-dir=build-aux  \
132                 --libtool $(GNULIB_MODULES)
133         if (glibtoolize --version) >/dev/null 2>&1; then        \
134                 LIBTOOLIZE=glibtoolize;                         \
135         elif (libtoolize --version) >/dev/null 2>&1; then       \
136                 LIBTOOLIZE=libtoolize;                          \
137         else                                                    \
138                 echo >&2 "libtoolize not found";                \
139                 exit 1;                                         \
140         fi;                                                     \
141         $$LIBTOOLIZE --force --automake
142
143 aclocal.m4:
144         aclocal -I m4 -I gl/m4
145
146 configure: configure.ac aclocal.m4
147         autoconf
148
149 config.h.in: configure.ac
150         autoheader
151
152 Makefile.in: Makefile.am config.h.in aclocal.m4
153         automake --add-missing --copy --no-force --include-deps
154
155
156 gettextize:
157         test -d m4 || mkdir m4
158         touch m4/Makefile.am
159         gettextize --force --no-changelog
160
161 check: all
162         rm -rf _check
163         mkdir _check
164         cd _check && ../configure $(CONFIGUREFLAGS)
165         cd _check && make distcheck
166         rm -rf _check
167
168 _build: all
169         test -d _build || mkdir _build
170         cd _build && ../configure $(CONFIGUREFLAGS)
171
172 _debug: all
173         test -d _debug || mkdir _debug
174         cd _debug && ../configure $(CONFIGUREFLAGS) --enable-debug
175
176 PO_FILES = po/ChangeLog \
177 po/Rules-quot po/boldquot.sed           \
178 po/cat-id-tbl.c po/en@boldquot.header po/en@quot.header                 \
179 po/insert-header.sin po/quot.sed po/remove-potcdate.sin po/stamp-po     \
180 po/Makevars.template po/pspp.pot
181
182 clean:
183         rm -f config.sub config.guess config.rpath
184         rm -fr autom4te.cache
185         rm -f aclocal.m4
186         rm -f missing mkinstalldirs
187         rm -f install-sh
188         rm -f configure Makefile 
189         rm -f depcomp
190         rm -rf intl gl
191         rm -f m4/*.m4
192         rm -f $(PO_FILES) po/*.gmo 
193         rm -f mdate-sh texinfo.tex
194         rm -f doc/stamp-vti
195         rm -f config.h.in~
196         rm -f config.h.in
197         find . -name Makefile.in -exec rm -f {} \; 
198         rm -f compile
199         rm -f ltmain.sh
200         rm -f reloc-ldflags install-reloc
201
202 .PHONY: all gettextize clean