work with BSD makefiles as well

This commit is contained in:
Lev Walkin 2017-07-06 00:02:31 +00:00
parent ef72650489
commit 221ce93307
1 changed files with 27 additions and 4 deletions

View File

@ -49,8 +49,13 @@ ln -fns "../${source_full}" "${testdir}"
asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1)
# Create a Makefile for the project.
cat > "$testdir/Makefile" <<EOM
# Create a BSD or GNU Makefile for the project.
produce_makefile() {
local make_type=$1
local make_file="$testdir/${make_type}makefile"
# 1/3 part of the Makefile.
cat > "${make_file}" <<PREAMBLE
# This file is autogenerated by ../$0
COMMON_FLAGS= -I. -I${abs_top_srcdir}/skeletons
@ -61,7 +66,20 @@ LDFLAGS = ${LDFLAGS:-}
CC ?= ${CC}
OBJS=\$(patsubst %.c,%.o,\$(wildcard *.c))
PREAMBLE
# 2/3 part of the Makefile.
if [ ${make_type} = "BSD" ]; then
cat >> ${make_file} <<-OBJECTS
SRCS!=find . -name \*.c
OBJS=\${SRCS:.c=.o}
OBJECTS
else
echo 'OBJS=$(patsubst %.c,%.o,$(wildcard *.c))' >> ${make_file}
fi
# 3/3 part of the Makefile.
cat >> "${make_file}" <<TARGETS
all: compiled-module
\$(MAKE) check-executable
@ -89,7 +107,12 @@ check: check-succeeded
clean:
@rm -f *.o check-executable
EOM
TARGETS
}
produce_makefile BSD
produce_makefile GNU
# Perform building and checking
${TEST_DRIVER} make -C "$testdir" check