# //@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:
ifndef TOPDIR
TOPDIR=.
endif

# Note: must include from $(SRCDIR) (which is redefined
#       when recursing into subdirs).
SRCDIR=.

# 'release.mak' must define CPSW_DIR
include $(TOPDIR)/release.mak
# while release.mak is in git, release.local.mak should
# not be and can be overridden for development and other
# purposes...
-include $(TOPDIR)/release.local.mak

include $(CPSW_DIR)/defs.mak

# 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 += mySubdir1 mySubdir2

# Headers to be installed (must exist prior to building or
# you must add a rule to pre-build them)
#HEADERS += myHeader.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. The file must be named <prefix>_git_version_string.h
# where you can choose an arbitrary prefix.
#
# The symbols
#
#  <PREFIX>_GIT_VERSION_STRING
#  <PREFIX>_MAJOR_VERSION
#  <PREFIX>_MINOR_VERSION
#  <PREFIX>_REVISION
#  <PREFIX>_DELTA_COMMIT
#
# will be defined where '<PREFIX>' ist <prefix> converted to upper-case.
# The MAJOR/MINOR/REVISION numbers are defined but it is assumed a git tag
# conforming to 'R<major>.<minor>.<revision>' is defined.
#GENERATED_SRCS += myPackage_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 += xxx.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 += myLib

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

# 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      += myOtherObj.so

# List tests to build (TESTPROGRAMS are not installed):
#TESTPROGRAMS     += myTest myOtherTest

# List sources for each target:
#myLib_SRCS       += mySrc1.cc
#myLib_SRCS       += mySrc2.c

#myProg_SRCS      += mySrc3.cc

#myTest_SRCS      += mySrc4.cc
#myOtherTest_SRCS += mySrc5.cc

# Identify directories where to look for headers:
#INCLUDE_DIRS     += somewhere

# 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)
#myProg_LIBS      += someLib $(CPSW_LIBS)

#myTest_LIBS      += someStaticLib.a $(CPSW_LIBS)
#myOtherTest_LIBS += someLib $(CPSW_LIBS)

# 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'
