1## Makefile for the lib subdirectory of GNU libtextstyle. 2## Copyright (C) 2009-2020 Free Software Foundation, Inc. 3## 4## This program is free software: you can redistribute it and/or modify 5## it under the terms of the GNU General Public License as published by 6## the Free Software Foundation; either version 3 of the License, or 7## (at your option) any later version. 8## 9## This program is distributed in the hope that it will be useful, 10## but WITHOUT ANY WARRANTY; without even the implied warranty of 11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12## GNU General Public License for more details. 13## 14## You should have received a copy of the GNU General Public License 15## along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17## Process this file with automake to produce Makefile.in. 18 19AUTOMAKE_OPTIONS = 1.13 gnits subdir-objects no-dependencies 20EXTRA_DIST = 21BUILT_SOURCES = 22MOSTLYCLEANFILES = core *.stackdump 23MOSTLYCLEANDIRS = 24CLEANFILES = 25DISTCLEANFILES = 26MAINTAINERCLEANFILES = 27SUFFIXES = 28 29lib_LTLIBRARIES = libtextstyle.la 30 31noinst_LTLIBRARIES = 32 33nobase_include_HEADERS = textstyle.h 34 35nobase_nodist_include_HEADERS = 36 37noinst_HEADERS = notinline.h 38 39AM_CPPFLAGS = \ 40 -I. -I$(srcdir) \ 41 -I$(top_builddir) -I$(top_srcdir) \ 42 -Iglib \ 43 -DIN_LIBTEXTSTYLE 44 45# Parameterization of the 'libxml' module: 46# When building a shared library, don't export the variables 47# xmlMalloc, xmlMallocAtomic, xmlRealloc, xmlFree, xmlMemStrdup. 48if INCLUDED_LIBXML 49AM_CPPFLAGS += -DLIBXML_STATIC 50endif 51 52if WOE32 53# On mingw, disable the declarations of *printf functions as aliases to the 54# corresponding __mingw_*printf functions, because they pull in a dependency 55# to the libgcc_s_sjlj DLL (through the symbols __udivdi3, __umoddi3). 56AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=0 57endif 58 59# Rules generated and collected by gnulib-tool. 60include Makefile.gnulib 61 62# Additional source files. 63libtextstyle_la_SOURCES += \ 64 color.h color.c \ 65 misc.h misc.c \ 66 version.c 67 68# The <stdbool.h> replacement that can be installed. 69nobase_nodist_include_HEADERS += \ 70 textstyle/stdbool.h 71 72# Produce a textstyle/stdbool.h that is not compiler dependent. 73# GCC >= 2.95 has <stdbool.h>. 74# AIX >= 5.3 has <stdbool.h>. 75# Solaris 10 and some HP-UX 11 versions have <stdbool.h> but it does not 76# necessarily work. 77textstyle/stdbool.h : $(STDBOOL_H) stdbool.mini.h 78 @MKDIR_P@ textstyle 79 rm -f $@-t $@ 80 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 81 echo '#if !defined _GL_STDBOOL_H'; \ 82 if test -f /usr/include/stdbool.h; then \ 83 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) || defined _AIX'; \ 84 else \ 85 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))'; \ 86 fi; \ 87 echo '#include <stdbool.h>'; \ 88 echo '#else'; \ 89 cat $(srcdir)/stdbool.mini.h; \ 90 echo '#endif'; \ 91 echo '#endif'; \ 92 } > $@-t 93 mv $@-t $@ 94BUILT_SOURCES += textstyle/stdbool.h 95MOSTLYCLEANFILES += textstyle/stdbool.h-t 96CLEANFILES += textstyle/stdbool.h 97EXTRA_DIST += stdbool.mini.h 98 99# textstyle/version.h is public. 100nobase_nodist_include_HEADERS += textstyle/version.h 101 102# textstyle/woe32dll.h is not public, but is included by other header files. 103nobase_nodist_include_HEADERS += textstyle/woe32dll.h 104 105# Directories that contain some CLEANFILES. 106CLEANDIRS = 107CLEANDIRS_NOT_IN_SRCDIR = 108clean-local: clean-generic 109 @for dir in '' $(CLEANDIRS); do \ 110 if test -n "$$dir" && test -d $$dir; then \ 111 echo "rmdir $$dir"; rmdir $$dir; \ 112 fi; \ 113 done; \ 114 if test '$(srcdir)' != '.'; then \ 115 for dir in '' $(CLEANDIRS_NOT_IN_SRCDIR); do \ 116 if test -n "$$dir" && test -d $$dir; then \ 117 echo "rmdir $$dir"; rmdir $$dir; \ 118 fi; \ 119 done; \ 120 fi; \ 121 : 122 123# Directories that contain some DISTCLEANFILES. 124DISTCLEANDIRS = sys 125DISTCLEANDIRS_NOT_IN_SRCDIR = textstyle 126distclean-local: distclean-generic 127 @for dir in '' $(DISTCLEANDIRS); do \ 128 if test -n "$$dir" && test -d $$dir; then \ 129 echo "rmdir $$dir"; rmdir $$dir; \ 130 fi; \ 131 done; \ 132 if test '$(srcdir)' != '.'; then \ 133 for dir in '' $(DISTCLEANDIRS_NOT_IN_SRCDIR); do \ 134 if test -n "$$dir" && test -d $$dir; then \ 135 echo "rmdir $$dir"; rmdir $$dir; \ 136 fi; \ 137 done; \ 138 fi; \ 139 : 140 141# List of header files that get installed and that declare 'extern' symbols. 142HEADERS_WITH_EXTERNS = \ 143 textstyle.h \ 144 textstyle/version.in.h 145 146# List of declared exported symbols. 147# We extract it from the header files that get installed. 148# This file has the same format as the one expected by the libtool option 149# '-export-symbols', but we don't use this option, because it may prevent us 150# from building some of the unit tests. 151$(srcdir)/libtextstyle.sym.in : $(HEADERS_WITH_EXTERNS) 152 if \ 153 for f in $(HEADERS_WITH_EXTERNS); do \ 154 if test -f $$f; then \ 155 cat $$f; \ 156 else \ 157 cat $(srcdir)/$$f; \ 158 fi; \ 159 done \ 160 | $(srcdir)/declared.sh > $@-t1; \ 161 then \ 162 LC_ALL=C sort < $@-t1 | LC_ALL=C uniq > $@-t2 && mv $@-t2 $@; \ 163 else \ 164 if test -f $@; then \ 165 echo "Continuing with existing libtextstyle.sym.in."; \ 166 else \ 167 exit 1; \ 168 fi; \ 169 fi 170# We distribute it because declared.sh relies on GNU sed. 171# The GNU Coding Standards say in 172# <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>: 173# "GNU distributions usually contain some files which are not source files 174# ... . Since these files normally appear in the source directory, they 175# should always appear in the source directory, not in the build directory. 176# So Makefile rules to update them should put the updated files in the 177# source directory." 178# Therefore we put this file in the source directory, not the build directory. 179MOSTLYCLEANFILES += libtextstyle.sym.in-t1 libtextstyle.sym.in-t2 180MAINTAINERCLEANFILES += libtextstyle.sym.in 181EXTRA_DIST += libtextstyle.sym.in declared.sh 182 183# List of exported symbols (platform dependent). 184libtextstyle.sym : $(srcdir)/libtextstyle.sym.in 185 cat $(srcdir)/libtextstyle.sym.in \ 186 | case "@host_os@" in \ 187 mingw*) cat ;; \ 188 *) grep -v '^libtextstyle_isatty$$' ;; \ 189 esac \ 190 > $@-t 191 mv $@-t $@ 192MOSTLYCLEANFILES += libtextstyle.sym libtextstyle.sym-t 193 194# Hide undesired symbols that are defined by libtextstyle_la_SOURCES or 195# gl_LIBOBJS or the dependency libraries from the global namespace, 196# by prefixing them with "libtextstyle_". 197all check install: config.h 198COMPILATION_UNITS = $(libtextstyle_la_SOURCES) $(gl_LIBOBJS) 199if INCLUDED_LIBCROCO 200COMPILATION_UNITS += $(libcroco_rpl_la_SOURCES) 201endif 202if INCLUDED_LIBXML 203COMPILATION_UNITS += $(libxml_rpl_la_SOURCES) 204endif 205if INCLUDED_LIBGLIB 206COMPILATION_UNITS += $(libglib_rpl_la_SOURCES) 207endif 208config.h: $(BUILT_SOURCES) libtextstyle.sym 209 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 210 : "Avoid double inclusion, to avoid a warning about redefinitions."; \ 211 echo '#ifndef LIBTEXTSTYLE_CONFIG_H'; \ 212 echo '#define LIBTEXTSTYLE_CONFIG_H'; \ 213 echo; \ 214 echo '#include "../config.h"'; \ 215 echo; \ 216 echo '#endif /* LIBTEXTSTYLE_CONFIG_H */'; \ 217 case "@host_os@" in \ 218 mingw*) echo '#define isatty libtextstyle_isatty' ;; \ 219 esac; \ 220 } > config.h && \ 221 if test -n "$(NAMESPACING)" && test -n "$(HAVE_GLOBAL_SYMBOL_PIPE)"; then \ 222 { \ 223 { \ 224 for f in $(COMPILATION_UNITS); do \ 225 case $$f in \ 226 *.res.lo ) ;; \ 227 *.c | *.$(OBJEXT) | *.lo ) \ 228 sf=`echo "$$f" | sed -e 's,\\.[^.]*$$,,'`.c; \ 229 test -f $$sf || sf=$(srcdir)/$$sf; \ 230 of=`echo "$$f" | sed -e 's,^.*/,,' -e 's,\\.[^.]*$$,,'`.$(OBJEXT); \ 231 echo "$(COMPILE) -c $$sf" 1>&6; \ 232 $(COMPILE) -c $$sf || { rm -f config.h; exit 1; }; \ 233 sh ./exported.sh $$of 1>&5; \ 234 rm -f $$of `echo "$$of" | sed -e 's,\\.$(OBJEXT)$$,.lo,'`; \ 235 ;; \ 236 esac; \ 237 done; \ 238 } 5>&1 1>&2 \ 239 | sed -e 's,.* ,,' | grep -v '@' | LC_ALL=C sort | LC_ALL=C uniq \ 240 | LC_ALL=C join -v 1 - libtextstyle.sym \ 241 | sed -e 's,^\(.*\)$$,#define \1 libtextstyle_\1,' > config.h-t; \ 242 } 6>&1 && \ 243 if test -f config.h; then \ 244 cat config.h-t >> config.h; \ 245 rm -f config.h-t; \ 246 else \ 247 rm -f config.h-t; \ 248 exit 1; \ 249 fi \ 250 fi 251MOSTLYCLEANFILES += config.h config.h-t 252 253# Version information according to Woe32 conventions. 254EXTRA_DIST += libtextstyle.rc 255if WOE32 256WOE32_LIBADD = libtextstyle.res.lo 257# This rule is executed only on Woe32 systems. 258# Use $(RC) with libtool, $(WINDRES) when not using libtool. 259# The following sed expressions come from the windres-options script. They are 260# inlined here, so that they can be written in a Makefile without requiring a 261# temporary file. They must contain literal newlines rather than semicolons, 262# so that they work with the sed-3.02 that is shipped with MSYS. 263libtextstyle.res.lo: $(srcdir)/libtextstyle.rc 264 nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \ 265 sed_extract_major='/^[0-9]/{'$${nl}'s/^\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ 266 sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ 267 sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ 268 $(LIBTOOL) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) \ 269 "-DPACKAGE_VERSION_STRING=\\\"$(VERSION)\\\"" \ 270 "-DPACKAGE_VERSION_MAJOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_major"` \ 271 "-DPACKAGE_VERSION_MINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_minor"` \ 272 "-DPACKAGE_VERSION_SUBMINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_subminor"` \ 273 -i $(srcdir)/libtextstyle.rc -o libtextstyle.res.lo --output-format=coff 274MOSTLYCLEANFILES += libtextstyle.res.lo 275else 276WOE32_LIBADD = 277endif 278libtextstyle_la_LIBADD += $(WOE32_LIBADD) 279libtextstyle_la_DEPENDENCIES += $(WOE32_LIBADD) 280 281# Parametrization of the 'relocatable-lib-lgpl' module. 282AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1 283 284# Libtool's library version information for libtextstyle. 285# See the libtool documentation, section "Library interface versions". 286LTV_CURRENT=1 287LTV_REVISION=1 288LTV_AGE=1 289 290# How to build libtextstyle.la. 291libtextstyle_la_LDFLAGS += \ 292 -no-undefined \ 293 -export-symbols libtextstyle.sym \ 294 -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ 295 -rpath $(libdir) 296