# //@C Copyright Notice
# //@C ================
# //@C This file is part of CPSW. It is subject to the license terms in the LICENSE.txt
# //@C file found in the top-level directory of this distribution and at
# //@C https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# //@C
# //@C No part of CPSW, including this file, may be copied, modified, propagated, or
# //@C distributed except according to the terms contained in the LICENSE.txt file.

# Makefile template for CPSW software:

# Locate CPSW:

CPSW_DIR=../framework/asyncSRP/src/

# from 'release.mak' CPSW_DIR and other variables
# which define package locations may be overridden.
# Note: must include from $(SRCDIR) (which is redefined
#       when recursing into subdirs).
SRCDIR=.

-include $(SRCDIR)/release.mak
include $(CPSW_DIR)/defs.mak

GIT_HASH_LONG:=$(shell git rev-parse HEAD)

# If you want to add your own ARCHSPECIFIC_VARS or
# ARCHSPECIFIC_LIBVARS then you *must* do so before
# including 'defs.mak'

# ARCHSPECIFIC_VARS    += MYVAR
# ARCHSPECIFIC_LIBVARS += mypackage


# Recurse into subdirectories (prior to making this directory)
SUBDIRS +=

# Headers to be installed (must exist prior to building or
# you must add a rule to pre-build them)
HEADERS += cpsw_gmp_api_user.h

# Sources which are generated by the makefile process. These
# end up in the source directory (and are cleaned):

# A rule is already present for generating a header containing
# the git version string
#GENERATED_SRCS += git_version_string.h

# If you have your own generated sources (or autogenerated READMEs etc)
# then your makefile must define rules how to build them...
#GENERATED_SRCS += mySrc.cc

# Modification of headers listed in DEP_HEADERS triggers
# re-computation of all dependencies.
#
# 'Ordinary' modification of headers (i.e., modifications which
# do not change the dependencies themselves) are tracked
# by the automatic dependency analysis.
# However, if any of the DEP_HEADERS changes then *all* dependencies
# are recomputed.
# Normally, only dependencies for individual .c and .cc files are
# recomputed as those change. 
DEP_HEADERS += $(HEADERS)
DEP_HEADERS += GmpZField.h

#The following variables are set:
#TARCH=<current target architecture>
#TARNM is used in makefile variable names:
#TARNM=<current target architecture with '-' replaced by '_'>

# List static libraries to build (only built if
# the user sets WITH_SHARED_LIBRARIES_<arch>=YES):
STATIC_LIBRARIES_YES += GmpZValInterface

# List shared libraries to build (only built if
# the user sets WITH_SHARED_LIBRARIES_<arch>=YES):
SHARED_LIBRARIES_YES += GmpZValInterface

GmpZValInterface_SRCS += GmpZValInterface.cc

# List programs to build:
#PROGRAMS         += myProg

# You can also build shared objects (installed where PROGRAMS are)
#PROGRAMS         += myObj.so

# or shared objects which are to be installed where libraries are:
SHARED_OBJS      += GmpZField.so

GmpZField_so_SRCS  += GmpZField.cc

# List tests to build (TESTPROGRAMS are not installed):
TESTPROGRAMS     += gmp_tst
TESTPROGRAMS     += git_hash_tst

gmp_tst_SRCS     += gmp_tst.cc

git_hash_tst_SRCS += git_hash_tst.cc

gmp_tst_LIBS       += GmpZValInterface $(CPSW_LIBS) gmp
git_hash_tst_LIBS  += GmpZValInterface $(CPSW_LIBS) gmp

USR_CXXFLAGS_default += -D'GIT_HASH_LONG="$(GIT_HASH_LONG)"'

# Identify libraries required by each program + testprogram.
# List them *without* 'lib' prefix or any suffix.
# Don't forget to add $(CPSW_LIBS) in order to link CPSW
# and any dependent libraries.

# You can enforce linking a static version of a particular
# library by appending '.a' (still no 'lib' prefix)

# Tell them where to look for 'someLib' -- this example
# shows how to look in a target-architecture specific
# subdirectory (of a package built with the same makefiles)
#
#someLib_DIR = some/package/path/O.$(TARCH)

# You can add logic to disable (execution) of
# some test programs. E.g., if you want
# to execute 'myOtherTest' only if the file 'foo' is 
# found:
#DISABLED_TESTPROGRAMS=$(if $(wildcard foo),,myOtherTest)

# Test programs are executed by the 'make test' target.
# 'make' fails if any test returns non-zero exit status.

# Include rules
include $(CPSW_DIR)/rules.mak

# include your own rules here; you can e.g., have a
# test program executed multiple times with different
# command line options:

# run 'myTest' twice: 'make test' will execute twice:
# with no options first ('') and then with '-O1 -o2'
#myTest_run: RUN_OPTS='' '-O1 -o2'

