move asn1 headers to include/ dir (1/5)

Add move-asn1-header-files.sh to do header file moving and sed'ding the include
statements. The file moving part is disabled until a later commit, to make
reading the diffs easier.

Call shell script from src/{hnbap,ranap,rua}/Makefile.am regen targets.

Add convenience regen target to src/Makefile.am, calling regen in the three subdirs.

This change is split over several commits to ease diff reading. Subsequent
commits show, in steps:
- the "unmoved" effect of sed,
- header moves,
- adjust build system and include statements.
This commit is contained in:
Neels Hofmeyr 2016-01-04 15:23:09 +01:00
parent 216ac210bf
commit 5aabad1380
5 changed files with 51 additions and 2 deletions

35
move-asn1-header-files.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# Usage:
# ../../move-asn1-headers.sh osmocom/foo/bar File1.h File2.h ...
set -e
base_dir="$(dirname "$0")"
include_subdir="$1"
shift
include_dir="$base_dir/include/$include_subdir"
mkdir -p "$include_dir"
echo "$PWD/*.h --> $include_dir"
sed_includes() {
while [ -n "$1" ]; do
fname="$1"
shift
echo 'sed -i "s,^#include \"'$fname'\"$,#include <'$include_subdir/$fname'>," *.[hc]'
sed -i "s,^#include \"$fname\"$,#include <$include_subdir/$fname>," *.[hc]
done
}
move_headers() {
echo mv $@ "$include_dir/"
mv $@ "$include_dir/"
}
# first replace all `#include "foo.h"' with `#include <dir/foo.h>' locally
sed_includes $@
# move sed'ed *.h files to the proper include/dir
#move_headers $@ TEMPORARILY DISABLED to simplify the diff

View File

@ -50,3 +50,11 @@ osmo_hnbgw_LDADD = $(OSMOCORE_LIBS) $(OSMOVTY_LIBS) $(OSMOGSM_LIBS) \
$(ASN1C_LIBS) $(OSMOSIGTRAN_LIBS) $(COMMON_LDADD) \
hnbap/libosmo-asn1-hnbap.a rua/libosmo-asn1-rua.a \
libosmo-ranap.la
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
make -C hnbap regen
make -C ranap regen
make -C rua regen

View File

@ -232,7 +232,7 @@ ASN_MODULE_INC= \
PrivateMessage.h \
IE.h
AM_CFLAGS = $(ASN1C_CFLAGS) $(OSMOCORE_CFLAGS) -I.
AM_CFLAGS = $(ASN1C_CFLAGS) $(OSMOCORE_CFLAGS) -I../../include
noinst_LIBRARIES=libosmo-asn1-hnbap.a
libosmo_asn1_hnbap_a_SOURCES=$(ASN_MODULE_SOURCES)
@ -244,4 +244,6 @@ regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
asn1c -gen-PER -fnative-types ../../asn1/hnbap/HNBAP-CommonDataTypes.asn ../../asn1/hnbap/HNBAP-Constants.asn ../../asn1/hnbap/HNBAP-IEs.asn ../../asn1/hnbap/HNBAP-PDU.asn
# remove the local copy of the runtime code
@rm ANY.* BOOLEAN.* INTEGER.* NativeEnumerated.* NativeInteger.* OBJECT_IDENTIFIER.* asn_* OCTET_STRING.* converter-sample.c per_* xer_* constr* der_* ber_* BIT_STRING.*
-rm ANY.* BOOLEAN.* INTEGER.* NativeEnumerated.* NativeInteger.* OBJECT_IDENTIFIER.* asn_* OCTET_STRING.* converter-sample.c per_* xer_* constr* der_* ber_* BIT_STRING.*
# change include style to `#include <dir/foo.h>'
../../move-asn1-header-files.sh osmocom/osmo-iuh/hnbap $(ASN_MODULE_INC)

View File

@ -1188,4 +1188,6 @@ regenerate-from-asn1-source:
sed -i 's/Member/MemberL/' RANAP_MessageStructure.[ch]
sed -i 's/Member/MemberM/' RANAP_PLMNs-in-shared-network.[ch]
sed -i 's/Member/MemberN/' RANAP_RABDataVolumeReport.[ch]
# change include style to `#include <dir/foo.h>'
../../move-asn1-header-files.sh osmocom/osmo-iuh/ranap $(ASN_MODULE_INC)

View File

@ -85,4 +85,6 @@ regenerate-from-asn1-source:
ASN1C_PREFIX="RUA_" asn1c -gen-PER ../../asn1/rua/RUA-CommonDataTypes.asn ../../asn1/rua/RUA-Constants.asn ../../asn1/rua/RUA-IEs.asn ../../asn1/rua/RUA-PDU.asn
# remove the local copy of the runtime code
@rm ANY.* BOOLEAN.* INTEGER.* NativeEnumerated.* NativeInteger.* OBJECT_IDENTIFIER.* asn_* OCTET_STRING.* converter-sample.c per_* xer_* constr* der_* ber_* BIT_STRING.*
# change include style to `#include <dir/foo.h>'
../../move-asn1-header-files.sh osmocom/osmo-iuh/rua $(ASN_MODULE_INC)