# 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=armv7-a -mfloat-abi=hard -mfpu=neon -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -Wp,-D_GLIBCXX_ASSERTIONS -pthread -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -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
# "-O2" enables (level 2) optimization (highly recommend not changing)
# "-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=armv7-a -mfloat-abi=hard -mfpu=neon -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -Wp,-D_GLIBCXX_ASSERTIONS -pthread -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -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
