1273562Smarcel#
2273562Smarcel# $Id$
3273562Smarcel#
4273562Smarcel# Copyright 2014, Juniper Networks, Inc.
5273562Smarcel# All rights reserved.
6273562Smarcel# This SOFTWARE is licensed under the LICENSE provided in the
7273562Smarcel# ../Copyright file. By downloading, installing, copying, or otherwise
8273562Smarcel# using the SOFTWARE, you agree to be bound by the terms of that
9273562Smarcel# LICENSE.
10273562Smarcel
11273562SmarcelACLOCAL_AMFLAGS = -I m4
12273562Smarcel
13287111SmarcelSUBDIRS = libxo xo xopo xolint xohtml tests doc encoder
14273562Smarcelbin_SCRIPTS=libxo-config
15273562Smarceldist_doc_DATA = Copyright
16273562Smarcel
17273562SmarcelEXTRA_DIST = \
18273562Smarcel    libxo-config.in \
19273562Smarcel    warnings.mk \
20273562Smarcel    README.md \
21273562Smarcel    INSTALL.md \
22273562Smarcel    packaging/libxo.spec
23273562Smarcel
24273562Smarcel.PHONY: test tests
25273562Smarcel
26273562Smarceltest tests:
27273562Smarcel	@(cd tests ; ${MAKE} test)
28273562Smarcel
29273562Smarcelerrors:
30273562Smarcel	@(cd tests/errors ; ${MAKE} test)
31273562Smarcel
32273562Smarceldocs:
33273562Smarcel	@(cd doc ; ${MAKE} docs)
34273562Smarcel
35273562Smarcel
36273562SmarcelDIST_FILES_DIR = ~/Dropbox/dist-files/
37273562SmarcelGH_PAGES_DIR = gh-pages/
38277353SmarcelGH_PAGES_DIR_VER = gh-pages/${PACKAGE_VERSION}
39273562SmarcelPACKAGE_FILE = ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.gz
40273562Smarcel
41322172SphilXOHTML_FILES = \
42322172Sphil    ${top_srcdir}/xohtml/xohtml.css \
43322172Sphil    ${top_srcdir}/xohtml/xohtml.js \
44322172Sphil    ${top_srcdir}/xohtml/external/jquery.js \
45322172Sphil    ${top_srcdir}/xohtml/external/jquery.qtip.css \
46322172Sphil    ${top_srcdir}/xohtml/external/jquery.qtip.js
47322172Sphil
48322172Sphilupload: dist upload-docs upload-xohtml-files
49273562Smarcel	@echo "Remember to run:"
50273562Smarcel	@echo "        gt tag ${PACKAGE_VERSION}"
51273562Smarcel
52273562Smarcelupload-docs: docs
53273562Smarcel	@echo "Uploading libxo-manual.html ... "
54273562Smarcel	@-[ -d ${GH_PAGES_DIR} ] \
55273562Smarcel		&& echo "Updating manual on gh-pages ..." \
56277353Smarcel		&& mkdir -p ${GH_PAGES_DIR_VER} \
57273562Smarcel		&& cp doc/libxo-manual.html ${GH_PAGES_DIR} \
58277353Smarcel		&& cp doc/libxo-manual.html ${GH_PAGES_DIR_VER} \
59273562Smarcel		&& (cd ${GH_PAGES_DIR} \
60277353Smarcel			&& git add ${PACKAGE_VERSION} \
61277353Smarcel			&& git add libxo-manual.html \
62273562Smarcel			&& git commit -m 'new docs' \
63277353Smarcel                               libxo-manual.html ${PACKAGE_VERSION} \
64273562Smarcel			&& git push origin gh-pages ) ; true
65273562Smarcel
66322172Sphilupload-xohtml-files:
67322172Sphil	@echo "Uploading xohtml files ... "
68322172Sphil	@-[ -d ${GH_PAGES_DIR} ] \
69322172Sphil		&& echo "Updating xohtml files on gh-pages ..." \
70322172Sphil		&& mkdir -p ${GH_PAGES_DIR_VER}/xohtml \
71322172Sphil		&& cp ${XOHTML_FILES} ${GH_PAGES_DIR_VER}/xohtml \
72322172Sphil		&& (cd ${GH_PAGES_DIR} \
73322172Sphil			&& git add ${PACKAGE_VERSION}/xohtml \
74322172Sphil			&& git commit -m 'new xohtml files' \
75322172Sphil                               ${PACKAGE_VERSION}/xohtml \
76322172Sphil			&& git push origin gh-pages ) ; true
77322172Sphil
78273562Smarcelpkgconfigdir=$(libdir)/pkgconfig
79273562Smarcelpkgconfig_DATA = packaging/${PACKAGE_NAME}.pc
80273562Smarcel
81273562Smarcelget-wiki:
82273562Smarcel	git clone https://github.com/Juniper/${PACKAGE_NAME}.wiki.git wiki
83273562Smarcel
84273562Smarcelget-gh-pages:
85273562Smarcel	git clone https://github.com/Juniper/${PACKAGE_NAME}.git \
86273562Smarcel		gh-pages -b gh-pages
87273562Smarcel
88273562SmarcelUPDATE_PACKAGE_FILE = \
89273562Smarcel    -e "s;__SHA1__;$$SHA1;" \
90273562Smarcel    -e "s;__SHA256__;SHA256 (textproc/${PACKAGE_FILE}) = $$SHA256;" \
91273562Smarcel    -e "s;__SIZE__;SIZE (textproc/${PACKAGE_FILE}) = $$SIZE;"
92273562Smarcel
93277353SmarcelGH_PACKAGING_DIR = ${PACKAGE_VERSION}/packaging
94273562SmarcelGH_PAGES_PACKAGE_DIR = ${GH_PAGES_DIR}/${GH_PACKAGING_DIR}
95273562Smarcel
96273562Smarcelpackages:
97273562Smarcel	@-[ -d ${GH_PAGES_DIR} ] && set -x \
98273562Smarcel		&& echo "Updating packages on gh-pages ..." \
99298083Sphil                && mkdir -p ${GH_PAGES_DIR}/${GH_PACKAGING_DIR} \
100273562Smarcel		&& SHA1="`openssl sha1 ${PACKAGE_FILE} | awk '{print $$2}'`" \
101273562Smarcel		&& SHA256="`openssl sha256 ${PACKAGE_FILE} | awk '{print $$2}'`" \
102273562Smarcel		&& SIZE="`ls -l ${PACKAGE_FILE} | awk '{print $$5}'`" \
103273562Smarcel		&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb ..." \
104273562Smarcel		&& sed ${UPDATE_PACKAGE_FILE} \
105273562Smarcel			packaging/${PACKAGE_NAME}.rb.base \
106273562Smarcel			> ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb \
107273562Smarcel		&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec ..." \
108273562Smarcel		&& cp packaging/${PACKAGE_NAME}.spec \
109273562Smarcel			${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec \
110273562Smarcel		&& (cd ${GH_PAGES_DIR} \
111273562Smarcel			&& git add ${GH_PACKAGING_DIR} \
112277353Smarcel			&& git add ${GH_PACKAGING_DIR}/libxo.rb \
113277353Smarcel                                   ${GH_PACKAGING_DIR}/libxo.spec \
114273562Smarcel			&& git commit -m 'new packaging data' \
115273562Smarcel                               ${GH_PACKAGING_DIR} \
116273562Smarcel			&& git push origin gh-pages ) ; true
117287111Smarcel
118287111SmarcelANALYZE_DIR = ~/trash/libxo
119287111SmarcelANALYZE_CMD = scan-build-mp-3.6
120287111Smarcel
121287111Smarcelanalyze:
122322172Sphil	${MAKE} clean
123287111Smarcel	${ANALYZE_CMD} -o ${ANALYZE_DIR} ${MAKE}
124322172Sphil
125322172SphilSANIFLAGS=-fno-omit-frame-pointer -g -O2
126322172Sphil
127322172Sphilsanitize-address:
128322172Sphil	${MAKE} clean
129322172Sphil	${MAKE} CFLAGS="-fsanitize=address ${SANIFLAGS}"
130322172Sphil	${MAKE} install
131322172Sphil	${MAKE} test
132322172Sphil
133322172Sphilsanitize-undefined:
134322172Sphil	${MAKE} clean
135322172Sphil	${MAKE} CFLAGS="-fsanitize=undefined ${SANIFLAGS}"
136322172Sphil	${MAKE} install
137322172Sphil	${MAKE} test
138322172Sphil
139322172Sphilsanitize-memory:
140322172Sphil	${MAKE} clean
141322172Sphil	${MAKE} CFLAGS="-fsanitize=memory ${SANIFLAGS}"
142322172Sphil	${MAKE} install
143322172Sphil	${MAKE} test
144