Commit 49157018 authored by Clément Vasseur's avatar Clément Vasseur
Browse files

Use make check instead of headers_test.sh

parent 7f41381e
/bitstream
/bitstream.pc
/examples/dvb_ecmg
/examples/dvb_ecmg_test
......
......@@ -55,7 +55,27 @@ dist:
bzip2 -9 > bitstream-$(VERSION).tar.bz2
clean:
$(RM) bitstream.pc
$(RM) bitstream bitstream.pc
$(MAKE) -C examples clean
.PHONY: all install uninstall dist clean
# if you want to check only particular headers,
# use make check HEADER_LIST="dvb/sim.h ietf/rtp.h"
HEADER_LIST = $$(find * -name '*.h')
FLAGS = -I. -Werror -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wformat=2
compiler_c = $(CC) $(FLAGS) $(CFLAGS)
compiler_c++ = $(CXX) $(FLAGS) $(CXXFLAGS)
compile = $(compiler_$1) -include "$$header" -c -x $1 /dev/null -o /dev/null
check:
@ln -nsf . bitstream
@for header in $(HEADER_LIST); do \
$(if $(V),set -x;) \
$(call compile,c) || exit 1; \
$(call compile,c++) || exit 1; \
echo "PASS: $$header"; \
done
.PHONY: all install uninstall dist clean check
#!/bin/sh
# Test if each header can be used standalone
# Copyright (C) 2011 Unix Solutions Ltd.
#
# License: MIT
# Authors: Georgi Chorbadzhiyski <georgi@unixsol.org>
#
HEADER_LIST="dvb/sim.h ietf/rtp.h"
# Find is used in such a way in order to work on OS X as well as Linux
# If you want to test only particular headers comment the line bellow
HEADER_LIST=$(find * | grep \\.h$ | sort | sed -e 's|^\./||')
for suffix in "c" "cpp"
do
case $suffix in
"cpp")
compiler="g++"
;;
*)
compiler="gcc"
;;
esac
for HDR in $HEADER_LIST
do
test_file=$(echo $HDR | sed -e 's|/|_|g;s|\.h$||')
echo "Testing ($compiler): $HDR"
printf "#include \"$HDR\"\n\nint main(void) { return 0; }\n" > $test_file.$suffix
$compiler -I.. -Werror -Wall -Wextra -Wno-unused -Wno-sign-compare -Wformat-security $test_file.$suffix -o $test_file
[ $? != 0 ] && exit 1
rm $test_file $test_file.$suffix
done
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment