2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
2004-05-02 16:04:40 +00:00
|
|
|
|
# Makefile for Mini-XML, a small XML-like file parsing library.
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
2019-01-05 01:44:51 +00:00
|
|
|
|
# https://www.msweet.org/mxml
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# Copyright © 2003-2024 by Michael R Sweet.
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
2019-01-05 01:44:51 +00:00
|
|
|
|
# Licensed under Apache License v2.0. See the file "LICENSE" for more
|
|
|
|
|
# information.
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# This is a POSIX makefile
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
.POSIX:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Mini-XML version...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
MXML_VERSION = @MXML_VERSION@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Programs...
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
AR = @AR@
|
|
|
|
|
CC = @CC@
|
2005-02-26 03:10:23 +00:00
|
|
|
|
DSO = @DSO@
|
2005-04-24 23:23:59 +00:00
|
|
|
|
INSTALL = @INSTALL@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
LN = @LN@ -sf
|
|
|
|
|
MKDIR = @MKDIR@ -p
|
2003-06-03 19:46:29 +00:00
|
|
|
|
RANLIB = @RANLIB@
|
2003-06-15 00:44:34 +00:00
|
|
|
|
RM = @RM@ -f
|
2024-02-27 20:04:27 +00:00
|
|
|
|
RMDIR = @RMDIR@
|
2003-06-03 19:46:29 +00:00
|
|
|
|
SHELL = /bin/sh
|
2024-02-27 20:04:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Installation programs...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
INSTALL_BIN = $(INSTALL) -c -m 755
|
|
|
|
|
INSTALL_DATA = $(INSTALL) -c -m 444
|
|
|
|
|
INSTALL_DIR = $(INSTALL) -d -m 755
|
|
|
|
|
INSTALL_LIB = $(INSTALL) -c -m 755
|
|
|
|
|
INSTALL_MAN = $(INSTALL) -c -m 444
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Libraries...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
LIBMXML = @LIBMXML@
|
2024-03-04 13:09:55 +00:00
|
|
|
|
LIBMXML_BASE = @LIBMXML_BASE@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
LIBMXML_STATIC = @LIBMXML_STATIC@
|
2024-04-21 20:55:44 +00:00
|
|
|
|
MXML_MAN = @MXML_MAN@
|
2024-03-04 13:09:55 +00:00
|
|
|
|
MXML_PC = @MXML_PC@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Install static libraries?
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
INSTALL_STATIC = @INSTALL_STATIC@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Code signing...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
CODE_SIGN = @CODE_SIGN@
|
|
|
|
|
CODESIGN_IDENTITY = -
|
|
|
|
|
CSFLAGS = -s "$(CODESIGN_IDENTITY)" @CSFLAGS@ --timestamp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Library archiver...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
ARFLAGS = @ARFLAGS@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# C compiler and preprocessor...
|
|
|
|
|
#
|
|
|
|
|
|
2024-03-21 21:16:39 +00:00
|
|
|
|
CFLAGS = @CFLAGS@ $(CPPFLAGS) $(OPTIM) $(WARNINGS)
|
2024-02-27 20:04:27 +00:00
|
|
|
|
CPPFLAGS = @CPPFLAGS@
|
2021-10-26 12:25:41 +00:00
|
|
|
|
WARNINGS = @WARNINGS@
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# Linker options...
|
|
|
|
|
#
|
|
|
|
|
|
2024-03-22 12:52:51 +00:00
|
|
|
|
DSOFLAGS = @DSOFLAGS@ $(OPTIM)
|
|
|
|
|
LDFLAGS = @LDFLAGS@ $(OPTIM)
|
2024-02-27 20:04:27 +00:00
|
|
|
|
LIBS = @LIBS@ -lm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Optimization and architecture options for both the compiler and linker.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
OPTIM = @OPTIM@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Directories...
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
|
2003-06-15 00:44:34 +00:00
|
|
|
|
bindir = @bindir@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
datadir = @datadir@
|
2007-07-20 23:52:25 +00:00
|
|
|
|
datarootdir = @datarootdir@
|
2024-03-21 01:07:20 +00:00
|
|
|
|
docdir = @docdir@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
exec_prefix = @exec_prefix@
|
2003-06-03 19:46:29 +00:00
|
|
|
|
includedir = @includedir@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
infodir = @infodir@
|
2003-06-03 19:46:29 +00:00
|
|
|
|
libdir = @libdir@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
libexecdir = @libexecdir@
|
|
|
|
|
localstatedir = @localstatedir@
|
2003-06-15 00:44:34 +00:00
|
|
|
|
mandir = @mandir@
|
2024-02-27 20:04:27 +00:00
|
|
|
|
oldincludedir = @oldincludedir@
|
|
|
|
|
prefix = @prefix@
|
|
|
|
|
sbindir = @sbindir@
|
|
|
|
|
sharedstatedir = @sharedstatedir@
|
|
|
|
|
srcdir = @srcdir@
|
|
|
|
|
sysconfdir = @sysconfdir@
|
|
|
|
|
top_srcdir = @top_srcdir@
|
2005-04-24 23:23:59 +00:00
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
BUILDROOT = $(DSTROOT)$(DESTDIR)
|
2005-04-24 23:23:59 +00:00
|
|
|
|
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
# Rules...
|
|
|
|
|
#
|
|
|
|
|
|
2011-01-03 02:03:29 +00:00
|
|
|
|
.SILENT:
|
2007-04-26 22:21:37 +00:00
|
|
|
|
.SUFFIXES: .c .man .o
|
2003-06-03 19:46:29 +00:00
|
|
|
|
.c.o:
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Compiling $<
|
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Targets...
|
|
|
|
|
#
|
|
|
|
|
|
2019-07-03 15:30:38 +00:00
|
|
|
|
DOCFILES = doc/mxml.epub doc/mxml.html doc/mxml-cover.png \
|
|
|
|
|
CHANGES.md LICENSE NOTICE README.md
|
2024-03-19 01:46:14 +00:00
|
|
|
|
PUBLIBOBJS = mxml-attr.o mxml-file.o mxml-get.o mxml-index.o \
|
|
|
|
|
mxml-node.o mxml-options.o mxml-search.o mxml-set.o
|
2024-02-27 20:04:27 +00:00
|
|
|
|
LIBOBJS = $(PUBLIBOBJS) mxml-private.o
|
2019-01-03 01:36:53 +00:00
|
|
|
|
OBJS = testmxml.o $(LIBOBJS)
|
2019-01-03 01:39:02 +00:00
|
|
|
|
ALLTARGETS = $(LIBMXML) testmxml
|
2019-01-03 01:36:53 +00:00
|
|
|
|
CROSSTARGETS = $(LIBMXML)
|
2017-03-29 15:23:29 +00:00
|
|
|
|
TARGETS = $(@TARGETS@)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Make everything...
|
|
|
|
|
#
|
|
|
|
|
|
2017-03-29 15:23:29 +00:00
|
|
|
|
all: $(TARGETS)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Clean everything...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
clean:
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Cleaning build files...
|
2017-04-05 13:47:24 +00:00
|
|
|
|
$(RM) $(OBJS) $(ALLTARGETS)
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(RM) mxml4.dll
|
|
|
|
|
$(RM) mxml4.lib
|
|
|
|
|
$(RM) libmxml4.a
|
|
|
|
|
$(RM) libmxml4.so
|
|
|
|
|
$(RM) libmxml4.so.1
|
|
|
|
|
$(RM) libmxml4.1.dylib
|
|
|
|
|
$(RM) libmxml4.dylib
|
2006-05-06 12:36:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Really clean everything...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
distclean: clean
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Cleaning distribution files...
|
2003-06-15 00:44:34 +00:00
|
|
|
|
$(RM) config.cache config.log config.status
|
2020-10-01 13:17:32 +00:00
|
|
|
|
$(RM) Makefile config.h mxml.pc
|
|
|
|
|
$(RM) test.xmlfd
|
|
|
|
|
$(RM) temp1.xml temp1.xmlfd temp1s.xml
|
|
|
|
|
$(RM) temp2.xml temp2s.xml
|
2003-06-15 00:44:34 +00:00
|
|
|
|
$(RM) -r autom4te*.cache
|
2006-05-06 12:36:35 +00:00
|
|
|
|
$(RM) *.bck *.bak
|
2008-11-28 10:56:50 +00:00
|
|
|
|
$(RM) -r clang
|
|
|
|
|
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
# Install everything...
|
|
|
|
|
#
|
|
|
|
|
|
2024-03-22 19:09:23 +00:00
|
|
|
|
.NOTPARALLEL: install install-$(LIBMXML) $(INSTALL_STATIC)
|
|
|
|
|
|
|
|
|
|
install: $(TARGETS) install-$(LIBMXML) $(INSTALL_STATIC)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing documentation in $(BUILDROOT)$(docdir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(docdir)
|
|
|
|
|
for file in $(DOCFILES); do \
|
2017-03-29 15:23:29 +00:00
|
|
|
|
$(INSTALL_MAN) $$file $(BUILDROOT)$(docdir)/`basename $$file .md`; \
|
2005-04-24 23:23:59 +00:00
|
|
|
|
done
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing header files in $(BUILDROOT)$(includedir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(includedir)
|
|
|
|
|
$(INSTALL_DATA) mxml.h $(BUILDROOT)$(includedir)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing pkgconfig files in $(BUILDROOT)$(libdir)/pkgconfig...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)/pkgconfig
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(INSTALL_DATA) mxml4.pc $(BUILDROOT)$(libdir)/pkgconfig/$(MXML_PC)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing man pages in $(BUILDROOT)$(mandir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(mandir)/man3
|
2024-04-21 20:55:44 +00:00
|
|
|
|
$(INSTALL_MAN) doc/mxml.3 $(BUILDROOT)$(mandir)/man3/$(MXML_MAN)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
2018-07-02 22:27:34 +00:00
|
|
|
|
install-libmxml.a: libmxml.a
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing libmxml.a to $(BUILDROOT)$(libdir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
|
|
|
|
$(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir)
|
2006-08-02 16:18:20 +00:00
|
|
|
|
$(RANLIB) $(BUILDROOT)$(libdir)/libmxml.a
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
install-libmxml.so.2: libmxml.so.2
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing libmxml.so to $(BUILDROOT)$(libdir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(INSTALL_LIB) libmxml.so.2 $(BUILDROOT)$(libdir)
|
2005-02-26 03:10:23 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(LN) libmxml.so.2 $(BUILDROOT)$(libdir)/libmxml.so
|
2019-07-03 15:30:38 +00:00
|
|
|
|
$(LDCONFIG)
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
install-libmxml.2.dylib: libmxml.2.dylib
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Installing libmxml.dylib to $(BUILDROOT)$(libdir)...
|
2005-04-24 23:23:59 +00:00
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(INSTALL_LIB) libmxml.2.dylib $(BUILDROOT)$(libdir)
|
2005-02-26 03:10:23 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.dylib
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(LN) libmxml.2.dylib $(BUILDROOT)$(libdir)/libmxml.dylib
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
install-libmxml4.a: libmxml4.a
|
|
|
|
|
echo Installing libmxml4.a to $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
|
|
|
|
$(INSTALL_LIB) libmxml4.a $(BUILDROOT)$(libdir)
|
|
|
|
|
$(RANLIB) $(BUILDROOT)$(libdir)/libmxml4.a
|
|
|
|
|
|
|
|
|
|
install-libmxml4.so.2: libmxml4.so.2
|
|
|
|
|
echo Installing libmxml4.so to $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
|
|
|
|
$(INSTALL_LIB) libmxml4.so.2 $(BUILDROOT)$(libdir)
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so
|
|
|
|
|
$(LN) libmxml4.so.2 $(BUILDROOT)$(libdir)/libmxml4.so
|
|
|
|
|
$(LDCONFIG)
|
|
|
|
|
|
|
|
|
|
install-libmxml4.2.dylib: libmxml4.2.dylib
|
|
|
|
|
echo Installing libmxml4.dylib to $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
|
|
|
|
|
$(INSTALL_LIB) libmxml4.2.dylib $(BUILDROOT)$(libdir)
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.dylib
|
|
|
|
|
$(LN) libmxml4.2.dylib $(BUILDROOT)$(libdir)/libmxml4.dylib
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
|
#
|
|
|
|
|
# Uninstall everything...
|
|
|
|
|
#
|
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
uninstall: uninstall-$(LIBMXML) @UNINSTALL_STATIC@
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling documentation from $(BUILDROOT)$(docdir)...
|
2004-02-04 21:24:03 +00:00
|
|
|
|
$(RM) -r $(BUILDROOT)$(docdir)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling headers from $(BUILDROOT)$(includedir)...
|
2004-02-04 21:24:03 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(includedir)/mxml.h
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling pkgconfig files from $(BUILDROOT)$(libdir)/pkgconfig...
|
2024-04-21 20:55:44 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/pkgconfig/$(MXML_PC)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling man pages from $(BUILDROOT)$(mandir)...
|
2024-04-21 20:55:44 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(mandir)/man3/$(MXML_MAN)
|
2003-06-04 16:30:40 +00:00
|
|
|
|
|
2005-02-26 03:10:23 +00:00
|
|
|
|
uninstall-libmxml.a:
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling libmxml.a from $(BUILDROOT)$(libdir)...
|
2005-02-26 03:10:23 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.a
|
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
uninstall-libmxml.so.2:
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling libmxml.so from $(BUILDROOT)$(libdir)...
|
2005-02-26 03:10:23 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.2
|
2019-07-03 15:30:38 +00:00
|
|
|
|
$(LDCONFIG)
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
uninstall-libmxml.2.dylib:
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Uninstalling libmxml.dylib from $(BUILDROOT)$(libdir)...
|
2005-02-26 03:10:23 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.dylib
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml.2.dylib
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
uninstall-libmxml4.a:
|
|
|
|
|
echo Uninstalling libmxml4.a from $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.a
|
|
|
|
|
|
|
|
|
|
uninstall-libmxml4.so.2:
|
|
|
|
|
echo Uninstalling libmxml4.so from $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so.2
|
|
|
|
|
$(LDCONFIG)
|
|
|
|
|
|
|
|
|
|
uninstall-libmxml4.2.dylib:
|
|
|
|
|
echo Uninstalling libmxml4.dylib from $(BUILDROOT)$(libdir)...
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.dylib
|
|
|
|
|
$(RM) $(BUILDROOT)$(libdir)/libmxml4.2.dylib
|
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
|
|
2021-10-26 12:25:41 +00:00
|
|
|
|
#
|
|
|
|
|
# Test everything...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
test: testmxml
|
|
|
|
|
@echo Testing library...
|
|
|
|
|
./testmxml test.xml temp1s.xml >temp1.xml
|
|
|
|
|
./testmxml temp1.xml temp2s.xml >temp2.xml
|
|
|
|
|
@if cmp temp1.xml temp2.xml; then \
|
|
|
|
|
echo Stdio file test passed!; \
|
|
|
|
|
$(RM) temp2.xml temp2s.xml; \
|
|
|
|
|
else \
|
|
|
|
|
echo Stdio file test failed!; \
|
2024-03-02 23:47:57 +00:00
|
|
|
|
exit 1; \
|
2021-10-26 12:25:41 +00:00
|
|
|
|
fi
|
|
|
|
|
@if cmp temp1.xml temp1s.xml; then \
|
|
|
|
|
echo String test passed!; \
|
|
|
|
|
$(RM) temp1.xml temp1s.xml; \
|
|
|
|
|
else \
|
|
|
|
|
echo String test failed!; \
|
2024-03-02 23:47:57 +00:00
|
|
|
|
exit 1; \
|
2021-10-26 12:25:41 +00:00
|
|
|
|
fi
|
|
|
|
|
@if cmp test.xml test.xmlfd; then \
|
|
|
|
|
echo File descriptor test passed!; \
|
|
|
|
|
$(RM) test.xmlfd temp1.xmlfd; \
|
|
|
|
|
else \
|
|
|
|
|
echo File descriptor test failed!; \
|
2024-03-02 23:47:57 +00:00
|
|
|
|
exit 1; \
|
2021-10-26 12:25:41 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2011-01-03 02:03:29 +00:00
|
|
|
|
#
|
|
|
|
|
# Figure out lines-of-code...
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
.PHONY: sloc
|
|
|
|
|
|
|
|
|
|
sloc:
|
|
|
|
|
echo "libmxml: \c"
|
|
|
|
|
sloccount $(LIBOBJS:.o=.c) mxml-private.c mxml.h 2>/dev/null | \
|
|
|
|
|
grep "Total Physical" | awk '{print $$9}'
|
|
|
|
|
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
# libmxml.a
|
|
|
|
|
#
|
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
libmxml.a libmxml4.a: $(LIBOBJS)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Creating $@...
|
2003-06-15 00:44:34 +00:00
|
|
|
|
$(RM) $@
|
2003-06-03 19:46:29 +00:00
|
|
|
|
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(LIBOBJS): mxml.h mxml-private.h
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
|
|
|
2017-04-23 16:21:38 +00:00
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# libmxml2.dll
|
2017-04-23 16:21:38 +00:00
|
|
|
|
#
|
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
libmxml.dll libmxml4.dll: $(LIBOBJS)
|
2017-04-23 16:21:38 +00:00
|
|
|
|
echo Creating $@...
|
2024-02-27 20:04:27 +00:00
|
|
|
|
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
|
2017-04-23 16:21:38 +00:00
|
|
|
|
|
|
|
|
|
|
2005-02-26 03:10:23 +00:00
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# libmxml.so.2
|
2005-02-26 03:10:23 +00:00
|
|
|
|
#
|
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
libmxml.so.2 libmxml4.so.2: $(LIBOBJS)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Creating $@...
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
|
|
|
|
|
$(RM) `basename $@ .2`
|
|
|
|
|
$(LN) $@ `basename $@ .2`
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
2024-02-27 20:04:27 +00:00
|
|
|
|
# libmxml.2.dylib
|
2005-02-26 03:10:23 +00:00
|
|
|
|
#
|
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
libmxml.2.dylib libmxml4.2.dylib: $(LIBOBJS)
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Creating $@...
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(DSO) $(DSOFLAGS) -o $@ \
|
|
|
|
|
-install_name $(libdir)/`basename $@ .2.dylib`.dylib \
|
2024-02-27 20:04:27 +00:00
|
|
|
|
-current_version 2.0.0 \
|
|
|
|
|
-compatibility_version 2.0.0 \
|
2018-07-04 06:10:30 +00:00
|
|
|
|
$(LIBOBJS) $(LIBS)
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(RM) `basename $@ .2.dylib`.dylib
|
|
|
|
|
$(LN) $@ `basename $@ .2.dylib`.dylib
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
#
|
|
|
|
|
# testmxml
|
|
|
|
|
#
|
|
|
|
|
|
2024-03-04 13:09:55 +00:00
|
|
|
|
testmxml: $(LIBMXML_STATIC) testmxml.o
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Linking $@...
|
2024-03-04 13:09:55 +00:00
|
|
|
|
$(CC) $(LDFLAGS) -o $@ testmxml.o $(LIBMXML_STATIC) $(LIBS)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
2011-03-24 05:47:51 +00:00
|
|
|
|
testmxml-vg: $(LIBOBJS) testmxml.o
|
|
|
|
|
echo Linking $@...
|
|
|
|
|
$(CC) $(LDFLAGS) -o $@ testmxml.o $(LIBOBJS) $(LIBS)
|
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
|
testmxml.o: mxml.h
|
|
|
|
|
|
2023-08-24 08:58:56 +00:00
|
|
|
|
# Fuzz-test the library <>
|
|
|
|
|
.PHONY: afl
|
|
|
|
|
afl:
|
|
|
|
|
$(MAKE) -$(MAKEFLAGS) CC="afl-clang-fast" COMMONFLAGS="-g" clean all
|
|
|
|
|
test afl-output || rm -rf afl-output
|
|
|
|
|
afl-fuzz -x xml.dict -i afl-input -o afl-output -V 600 -e xml -t 5000 ./testmxml @@ temps.xml
|
2003-06-04 16:30:40 +00:00
|
|
|
|
|
2021-10-26 12:25:41 +00:00
|
|
|
|
#
|
|
|
|
|
# Analyze code with the Clang static analyzer <https://clang-analyzer.llvm.org>
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
.PHONY: clang
|
|
|
|
|
clang:
|
|
|
|
|
clang $(CPPFLAGS) --analyze $(OBJS:.o=.c) 2>clang.log
|
|
|
|
|
rm -rf $(OBJS:.o=.plist)
|
|
|
|
|
test -s clang.log && (echo "$(GHA_ERROR)Clang detected issues."; echo ""; cat clang.log; exit 1) || exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Analyze code using Cppcheck <http://cppcheck.sourceforge.net>
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
.PHONY: cppcheck
|
|
|
|
|
cppcheck:
|
|
|
|
|
cppcheck $(CPPFLAGS) --template=gcc --addon=cert.py --suppressions-list=.cppcheck $(OBJS:.o=.c) 2>cppcheck.log
|
|
|
|
|
test -s cppcheck.log && (echo "$(GHA_ERROR)Cppcheck detected issues."; echo ""; cat cppcheck.log; exit 1) || exit 0
|
|
|
|
|
|
|
|
|
|
|
2003-06-05 13:49:14 +00:00
|
|
|
|
#
|
2019-01-03 03:54:23 +00:00
|
|
|
|
# Documentation (depends on separate codedoc utility)
|
2003-06-05 13:49:14 +00:00
|
|
|
|
#
|
|
|
|
|
|
2019-01-03 03:54:23 +00:00
|
|
|
|
.PHONY: doc
|
|
|
|
|
doc: mxml.h $(PUBLIBOBJS:.o=.c) \
|
|
|
|
|
doc/body.md doc/body.man doc/footer.man \
|
|
|
|
|
doc/mxml-cover.png
|
2011-01-03 02:03:29 +00:00
|
|
|
|
echo Generating API documentation...
|
2003-06-15 00:44:34 +00:00
|
|
|
|
$(RM) mxml.xml
|
2019-01-03 01:36:53 +00:00
|
|
|
|
codedoc --body doc/body.md \
|
2017-04-08 17:07:30 +00:00
|
|
|
|
--coverimage doc/mxml-cover.png \
|
2019-01-03 03:54:23 +00:00
|
|
|
|
mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/mxml.html
|
|
|
|
|
codedoc --body doc/body.md \
|
|
|
|
|
--coverimage doc/mxml-cover.png \
|
|
|
|
|
--epub doc/mxml.epub mxml.xml
|
|
|
|
|
codedoc --man mxml --title "Mini-XML API" \
|
|
|
|
|
--body doc/body.man --footer doc/footer.man \
|
|
|
|
|
mxml.xml >doc/mxml.3
|
|
|
|
|
$(RM) mxml.xml
|
2017-03-31 17:38:06 +00:00
|
|
|
|
|
|
|
|
|
|
2003-06-04 16:30:40 +00:00
|
|
|
|
#
|
2017-03-31 17:38:06 +00:00
|
|
|
|
# All object files depend on the makefile and config header...
|
2003-06-04 16:30:40 +00:00
|
|
|
|
#
|
|
|
|
|
|
2003-07-20 13:41:17 +00:00
|
|
|
|
$(OBJS): Makefile config.h
|