1#------------------------------------------------------------------------------
2
3# read the generic settings
4include	../../Makefile.defaults
5include	../../env.properties
6
7#------------------------------------------------------------------------------
8
9#  API_PKG_PATH	= com/mysql/cluster
10
11  DDEFINES 	=
12
13  DELIVERABLES	= libcrundndb.a libcrundndb.$(DLL_SUFFIX) NdbApiDriver
14
15  GENERATED_H	= com_mysql_cluster_crund_NdbApiLoad.h
16
17  CLEAN		= core *.o $(GENERATED_H)
18
19  MOSTLYCLEAN	= $(DELIVERABLES) *.dSYM *% log_*
20
21  DISTCLEAN	= *~ *% */*~
22
23  INCLUDES	= $(JAVA_INCLUDEOPTS) -I. -I"$(MARTINS_LITTLE_HELPERS)"	\
24		  $(NDB_INCLUDEOPT0) $(NDB_INCLUDEOPT1)
25
26# for library dependencies, LOADLIBES and LDLIBS have been used historically
27# this convention is used sometimes: use
28#   LDLIBS for project-wide libs (like -lc or -lm)
29#   LOADLIBES for libs for the individual case
30# check with non-gnu makes: use of LOADLIBES, LDLIBS
31  LDLIBS	= -L${NDB_LIBDIR} -lndbclient
32# XXX undefined symbols when linking with
33#  LOADLIBES	= -L$(MARTINS_LITTLE_HELPERS) -lutils
34# XXX which seems to be the same as
35#  LOADLIBES	= $(MARTINS_LITTLE_HELPERS)/libutils.dylib
36# XXX but linking statically is fine:
37  LOADLIBES	= $(MARTINS_LITTLE_HELPERS)/libutils.a
38
39#------------------------------------------------------------------------------
40
41.PHONY:	all depend dep run.driver valgrind.driver
42
43all:	$(DELIVERABLES)
44
45dep depend:	$(GENERATED_H)
46
47com_mysql_cluster_crund_NdbApiLoad.h:
48	cd ../.. && ant dep
49
50#com_mysql_cluster_NdbApiLoad.h:	$(API_PKG_PATH)/NdbApiLoad.class
51#	$(COMPILE.javah) com.mysql.cluster.NdbApiLoad
52#
53#$(API_PKG_PATH)/NdbApiLoad.class:	\
54#		$(API_PKG_PATH)/NdbApiLoad.java
55#	$(COMPILE.java) $<
56
57# not sure if needed:
58#	LD_LIBRARY_PATH=${NDB_LIBDIR}:./Driver
59run.driver:	NdbApiDriver
60	./NdbApiDriver \
61	-p ../../crundRun.properties -p ../../crundNdbapi.properties
62
63# for JVM processes, try running valgrind with
64# --smc-check=all --trace-children=yes --leak-check=full --show-reachable=yes
65# not sure if needed:
66#	LD_LIBRARY_PATH=${NDB_LIBDIR}:./Driver
67valgrind.driver:	NdbApiDriver
68	valgrind \
69	--leak-check=full --show-reachable=yes --trace-children=yes \
70	./NdbApiDriver \
71	-p ../../crundRun.properties -p ../../crundNdbapi.properties
72
73NdbApiDriver:	Driver.o CrundDriver.o libcrundndb.a
74
75# can list multiple archive members: lib.a(a.o b.o ...) lib.a(c.o)...
76libcrundndb.a:	libcrundndb.a(CrundNdbApiOperations.o)	\
77		libcrundndb.a(com_mysql_cluster_crund_NdbApiLoad.o)
78
79# XXX cleanup & refactorize this rule!
80# LINK.o
81#libcrundndb.so:	CrundNdbApiOperations.o com_mysql_cluster_crund_NdbApiLoad.o
82#libcrundndb.so:	libcrundndb.a
83libcrundndb.so:	CrundNdbApiOperations.cpp
84	$(LINK.cpp) \
85	-fPIC -shared \
86	-L${NDB_LIBDIR} \
87	-lndbclient \
88	-o libcrundndb.so \
89	CrundNdbApiOperations.cpp com_mysql_cluster_crund_NdbApiLoad.cpp
90
91libcrundndb.dylib:	CrundNdbApiOperations.cpp
92	$(LINK.cpp) \
93	-fPIC -shared -dynamiclib \
94	-L${NDB_LIBDIR} \
95	-lndbclient \
96	-o libcrundndb.dylib \
97	CrundNdbApiOperations.cpp com_mysql_cluster_crund_NdbApiLoad.cpp
98
99# Solaris cc?
100# -#          <!-- verbose mode -->
101# -G          <!-- create shared object -->
102# cc \
103# 	-# \
104# 	-I. \
105# 	-I${JAVA_HOME}/include \
106# 	-I${JAVA_HOME}/include/solaris \
107# 	-I${NDB_INCLUDE} \
108# 	-I${NDB_INCLUDE}/ndbapi \
109# 	-L${NDB_LIB} \
110# 	-lndbclient \
111# 	-G \
112# 	-o libcrundndb.so \
113# 	../src/crundndb/*.cpp
114
115#------------------------------------------------------------------------------
116
117.depend:
118	touch $@
119
120# read local dependencies
121-include	.depend
122
123#------------------------------------------------------------------------------
124