Commit 221ce933 authored by Lev Walkin's avatar Lev Walkin

work with BSD makefiles as well

parent ef726504
...@@ -49,8 +49,13 @@ ln -fns "../${source_full}" "${testdir}" ...@@ -49,8 +49,13 @@ ln -fns "../${source_full}" "${testdir}"
asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1) asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1)
# Create a Makefile for the project. # Create a BSD or GNU Makefile for the project.
cat > "$testdir/Makefile" <<EOM 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 # This file is autogenerated by ../$0
COMMON_FLAGS= -I. -I${abs_top_srcdir}/skeletons COMMON_FLAGS= -I. -I${abs_top_srcdir}/skeletons
...@@ -61,7 +66,20 @@ LDFLAGS = ${LDFLAGS:-} ...@@ -61,7 +66,20 @@ LDFLAGS = ${LDFLAGS:-}
CC ?= ${CC} 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 all: compiled-module
\$(MAKE) check-executable \$(MAKE) check-executable
...@@ -89,7 +107,12 @@ check: check-succeeded ...@@ -89,7 +107,12 @@ check: check-succeeded
clean: clean:
@rm -f *.o check-executable @rm -f *.o check-executable
EOM TARGETS
}
produce_makefile BSD
produce_makefile GNU
# Perform building and checking # Perform building and checking
${TEST_DRIVER} make -C "$testdir" check ${TEST_DRIVER} make -C "$testdir" check
......
Markdown is supported
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