# SPDX-License-Identifier: Apache-2.0
#
# Copyright IBM Corp. 2021
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Make sure that all symbols in zdnn.h are exported by the library

# This compares the symboles exported in the header file with the
# symbols actually visible in the resulting library.  Although this
# check depends on the way symbols are exported on Linux it is still
# useful on z/OS to get notified when things are getting out of sync
# between Linux and z/OS.

zdnn.i: zdnn.h
	$(CC) $(CPP_SYMCHECK_FLAGS) $<

symcheck: $(SODIR)/$(LIBNAME).so zdnn.i
ifneq ($(READELF),)
	$(READELF) -W --dyn-syms $(SODIR)/$(LIBNAME).so > zdnn.dynsyms
	awk -f sym_checker.awk zdnn.i zdnn.map zdnn.dynsyms >symcheck
	cat symcheck
endif
