mirror of https://gerrit.osmocom.org/asn1c
refactor autogeneration
This commit is contained in:
parent
221ce93307
commit
c56b566453
|
@ -49,14 +49,11 @@ ln -fns "../${source_full}" "${testdir}"
|
|||
|
||||
asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1)
|
||||
|
||||
# Create a BSD or GNU Makefile for the project.
|
||||
produce_makefile() {
|
||||
local make_type=$1
|
||||
local make_file="$testdir/${make_type}makefile"
|
||||
AUTOGENERATED="# This file is autogenerated by $0 ${source_full} ${AFLAGS}"
|
||||
|
||||
# 1/3 part of the Makefile.
|
||||
cat > "${make_file}" <<PREAMBLE
|
||||
# This file is autogenerated by ../$0
|
||||
# Create a common Makefile for the project
|
||||
cat <<TARGETS > "${testdir}/Makefile.targets"
|
||||
${AUTOGENERATED}
|
||||
|
||||
COMMON_FLAGS= -I. -I${abs_top_srcdir}/skeletons
|
||||
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O0
|
||||
|
@ -66,21 +63,6 @@ LDFLAGS = ${LDFLAGS:-}
|
|||
|
||||
CC ?= ${CC}
|
||||
|
||||
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
|
||||
|
||||
|
@ -109,10 +91,30 @@ clean:
|
|||
@rm -f *.o check-executable
|
||||
TARGETS
|
||||
|
||||
# Create a BSD- or GNU-specific Makefile for the project.
|
||||
produce_specific_makefile() {
|
||||
local make_type=$1
|
||||
local make_file="$testdir/${make_type}makefile"
|
||||
|
||||
if [ ${make_type} = "BSD" ]; then
|
||||
cat <<-OBJECTS >> ${make_file}
|
||||
${AUTOGENERATED}
|
||||
SRCS!=find . -name \*.c
|
||||
OBJS=\${SRCS:.c=.o}
|
||||
.sinclude Makefile.targets
|
||||
OBJECTS
|
||||
else
|
||||
cat <<-OBJECTS >> ${make_file}
|
||||
${AUTOGENERATED}
|
||||
OBJS=\$(patsubst %.c,%.o,\$(wildcard *.c))
|
||||
-include Makefile.targets
|
||||
OBJECTS
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
produce_makefile BSD
|
||||
produce_makefile GNU
|
||||
produce_specific_makefile BSD
|
||||
produce_specific_makefile GNU
|
||||
|
||||
# Perform building and checking
|
||||
${TEST_DRIVER} make -C "$testdir" check
|
||||
|
|
Loading…
Reference in New Issue