Browse Source

Use make check instead of headers_test.sh

master
Clément Vasseur 7 years ago
parent
commit
491570184e
3 changed files with 23 additions and 35 deletions
  1. +1
    -0
      .gitignore
  2. +22
    -2
      Makefile
  3. +0
    -33
      headers_test.sh

+ 1
- 0
.gitignore View File

@ -1,3 +1,4 @@
/bitstream
/bitstream.pc
/examples/dvb_ecmg
/examples/dvb_ecmg_test

+ 22
- 2
Makefile View File

@ -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

+ 0
- 33
headers_test.sh View File

@ -1,33 +0,0 @@
#!/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

Loading…
Cancel
Save