# This is a sample makefile that can be used to compile programs using 
# an installed version of NTL.
# Using this ensures that your programs compile with flags consistent
# with the build, and link to the right libraries.
#
# The basic functionality provided by this makefile is to allow
# you to compile 'foo.cpp' into the executable file 'foo' by executing
#    make foo   
# You can adapt this to the needs of your own project as necessary.


.cpp:
	g++ -I/usr/include   -march=x86-64-v2 -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mpclmul -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/startdir/src=/usr/src/debug/ntl -flto=auto -falign-functions=32 -pthread -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto -falign-functions=32 -o $@ $< -L/usr/lib  -Wl,-rpath,/usr/lib -lntl

# ntl was installed as a shared library with dependencies: gmp gf2x

# COMPILER OPTIONS
# "-I/usr/include" ensures ntl header files found at compile time
# "-g" enables the debugger
# "-pthread" enables multi-threading (also needed for linking)
# "$<" expands to "foo.cpp" when run as "make foo"

# LINKER OPTIONS
# "-o $@" expands to "-o foo" when run as "make foo"
# "-L/usr/lib" ensures ntl is found at link time
# "-Wl,-rpath,/usr/lib" ensures ntl is found at runtime
#    alternatively, add /usr/lib to LD_LIBRARY_PATH
# "-lntl" ensures that program will link to ntl

# ntl was installed using libtool

# in your project, you could alternatively compile and link as follows:
#	libtool --tag=CXX --mode=link g++ -I/usr/include   -march=x86-64-v2 -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mpclmul -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/startdir/src=/usr/src/debug/ntl -flto=auto -falign-functions=32 -pthread -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto -falign-functions=32 -o $@ $< -L/usr/lib  -lntl
# which ensures ntl all dependencies are properly linked and accessible at runtime
# and may offer convenient access to more linkage options via libtool
