blob: e76d8ec0b8770fb2ffdeb35ded304ab62eb61158 [file] [log] [blame]
Jeffrey Walton5dd52922018-02-05 06:19:36 -05001# For GNU conventions and targets see https://www.gnu.org/prep/standards/standards.html
2# Using GNU standards makes it easier for some users to keep doing what they are used to.
3
4# 'mkdir -p' is non-portable, but it is widely supported. A portable solution
5# is elusive due to race conditions on testing the directory and creating it.
6# Anemic toolchain users can sidestep the problem using MKDIR="mkdir".
7
8AR = ar
9ARFLAGS = cr
10RM = rm -f
11RANLIB = ranlib
12MKDIR = mkdir -p
Masadow4be5bc82018-10-09 14:57:44 +020013CXXFLAGS = -fPIC
Jeffrey Walton5dd52922018-02-05 06:19:36 -050014
15INSTALL = install
16INSTALL_PROGRAM = $(INSTALL)
Jeffrey Waltonff754302018-02-05 08:00:08 -050017INSTALL_DATA = $(INSTALL) -m 644
Jeffrey Walton5dd52922018-02-05 06:19:36 -050018
19prefix = /usr/local
20bindir = $(prefix)/bin
21libdir = $(prefix)/lib
22includedir = $(prefix)/include
23
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030024all: xmltest staticlib
25
26rebuild: clean all
27
Felipe "Zoc" Silveira04639a52016-06-08 19:11:37 -030028xmltest: xmltest.cpp libtinyxml2.a
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030029
Lee Thomason8b83b232017-10-11 10:13:35 -070030effc:
31 gcc -Werror -Wall -Wextra -Wshadow -Wpedantic -Wformat-nonliteral \
32 -Wformat-security -Wswitch-default -Wuninitialized -Wundef \
33 -Wpointer-arith -Woverloaded-virtual -Wctor-dtor-privacy \
34 -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo \
35 -Wno-unused-parameter -Weffc++ xmltest.cpp tinyxml2.cpp -o xmltest
36
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030037clean:
Jeffrey Walton5dd52922018-02-05 06:19:36 -050038 -$(RM) *.o xmltest libtinyxml2.a
39
40# Standard GNU target
41distclean:
42 -$(RM) *.o xmltest libtinyxml2.a
Jeffrey Waltonff754302018-02-05 08:00:08 -050043
Daniel Stevens22e5db12020-02-04 03:50:07 -070044test: xmltest
Bruno Dias032aa1b2013-07-31 12:01:12 -030045 ./xmltest
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030046
Jeffrey Walton5dd52922018-02-05 06:19:36 -050047# Standard GNU target
Daniel Stevens22e5db12020-02-04 03:50:07 -070048check: xmltest
Jeffrey Walton5dd52922018-02-05 06:19:36 -050049 ./xmltest
50
Felipe "Zoc" Silveira04639a52016-06-08 19:11:37 -030051staticlib: libtinyxml2.a
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030052
Felipe "Zoc" Silveira04639a52016-06-08 19:11:37 -030053libtinyxml2.a: tinyxml2.o
Jeffrey Walton5dd52922018-02-05 06:19:36 -050054 $(AR) $(ARFLAGS) $@ $^
55 $(RANLIB) $@
Jeffrey Waltonff754302018-02-05 08:00:08 -050056
Felipe "Zoc" Silveira48daa2d2016-05-22 00:14:31 -030057tinyxml2.o: tinyxml2.cpp tinyxml2.h
58
Jeffrey Walton5dd52922018-02-05 06:19:36 -050059directories:
60 $(MKDIR) $(DESTDIR)$(prefix)
61 $(MKDIR) $(DESTDIR)$(bindir)
62 $(MKDIR) $(DESTDIR)$(libdir)
63 $(MKDIR) $(DESTDIR)$(includedir)
64
65# Standard GNU target.
66install: xmltest staticlib directories
67 $(INSTALL_PROGRAM) xmltest $(DESTDIR)$(bindir)/xmltest
68 $(INSTALL_DATA) tinyxml2.h $(DESTDIR)$(includedir)/tinyxml2.h
69 $(INSTALL_DATA) libtinyxml2.a $(DESTDIR)$(libdir)/libtinyxml2.a
70
71# Standard GNU target
72uninstall:
73 $(RM) $(DESTDIR)$(bindir)/xmltest
74 $(RM) $(DESTDIR)$(includedir)/tinyxml2.h
75 $(RM) $(DESTDIR)$(libdir)/libtinyxml2.a