diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..97de039 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,32 @@ +SHELL=/bin/bash +OPTFLAGS=-O2 -flto -g +EXPORTFLAGS=-fvisibility=hidden -fpic -Wl,--export-dynamic +CPPFLAGS=-std=gnu++11 -I../include -I/home/michael/tmp/gmt5/include/gmt +LIBSFLAGS=-L/home/michael/tmp/gmt5/lib64 -Wl,-rpath /home/michael/tmp/gmt5/lib64 -lgmt -ldl -lpthread $(MODLIBS) +WARNFLAGS=-Wall + +CFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(CPPFLAGS) +LDFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(LIBSFLAGS) + +CC=g++ + +SOURCE = $(wildcard *.cpp) +DEPENDS = $(subst .cpp,.d,$(SOURCE)) +OBJECTS = $(subst .cpp,.o,$(SOURCE)) + +gmttest: $(OBJECTS) $(MODOBJECTS) + $(CC) -o $@ $(OBJECTS) $(MODOBJECTS) $(LDFLAGS) + +include $(DEPENDS) + +%.o: %.cpp + $(CC) -c $(CFLAGS) -o $@ $< + +%.d: %.cpp + $(CC) $(CPPFLAGS) -MM -MT $(subst .cpp,.o,$<) $< | sed 's%\(^.*\):%\1 $@ :%g' >$@ + +clean: + rm -f *.o *.d + +distclean: clean + rm -f gmttest \ No newline at end of file diff --git a/test/gmttest.cpp b/test/gmttest.cpp new file mode 100644 index 0000000..beaf607 --- /dev/null +++ b/test/gmttest.cpp @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include + +int print_func(FILE* fd, const char* str) +{ + std::cout<<"PRINT: "<