Debian Codegraph @

lang/sql/sqlite/ext/bfile/build/Makefile

raw
1 #!/usr/make
2 #
3 # Makefile for DBSQL BFile
4 #
5 # This makefile is suppose to be build for linux and windriver-ovia.
6 # But if that does not work for you, you can configure the makefile
7 # manually. Just set the parameters below to values that
8 # work well for your system.
9 #
10
11 # The toplevel directory of the source tree.
12 #
13 TOP = ../
14 # When manipulating BFILE, if you want to use c-functions set it to 1;
15 # Otherwise, set it to zero
16 ENABLE_BFILE_CAPI = 0
17
18 # The ovia options
19 #
20 ifeq ($(BUILD_OVIA), 1)
21 CROSS_COMPILE = arm-wrs-linux-gnueabi-arm_novfp-glibc_small-
22 CFLAGS += -msoft-float
23 CFLAGS += -I$(WIND_BASE)/wrlinux/target-libs/glibc_small/arm-wrs-linux-gnueabi-arm_novfp/include
24 CFLAGS += -L$(WIND_BASE)/wrlinux/target-libs/glibc_small/arm-wrs-linux-gnueabi-arm_novfp/lib
25 #TLIBS += -ldl
26 endif
27
28 # C Compile and options for use in building executables that
29 # will run on the target platform.
30 #
31 TCC = $(CROSS_COMPILE)gcc
32 TCC += $(CFLAGS) -fPIC -O3 -I${TOP}/include -I$(DBSQL_DIR)/include -I../../../../generated -I../../../src
33 ifeq ($(ENABLE_BFILE_CAPI), 1)
34 TCC += -DBFILE_USE_CAPIS
35 endif
36
37 # Any target libraries which libsqlite must be linked against
38 #
39 TLIBS += -lpthread -ldl
40
41 # The directory into which to store package information for
42
43 # Some standard variables and programs
44 #
45 prefix = $(DBSQL_DIR)
46 exec_prefix = ${prefix}
47 libdir = ${exec_prefix}/lib
48 includedir = ${prefix}/include
49 INSTALL = /usr/bin/install -c
50
51 # You should not have to change anything below this line
52 ###############################################################################
53
54
55 # This is the default Makefile target. The objects listed here
56 # are what get build when you type just "make" with no arguments.
57 #
58 ifndef DBSQL_DIR
59 all:
60 echo "Please set the correct path for DBSQL_DIR"
61 else
62 all: libbfile_ext.so bfile_test bfile_example
63 endif
64
65 libbfile_ext.so: $(TOP)/src/bfile.c $(TOP)/include/bfile.h
66 $(TCC) $(TOP)/src/bfile.c -o libbfile_ext.so -shared
67
68 ifeq ($(ENABLE_BFILE_CAPI), 0)
69 bfile_test: $(TOP)/test/bfile_test_sql.c $(TOP)/include/bfile.h libbfile_ext.so
70 $(TCC) $(TOP)/test/bfile_test_sql.c -o bfile_test_sql $(TLIBS) -L. -lbfile_ext -L$(DBSQL_DIR)/lib -ldb_sql -ldl
71 bfile_example: $(TOP)/examples/bfile_example_sql.c $(TOP)/include/bfile.h libbfile_ext.so
72 $(TCC) $(TOP)/examples/bfile_example_sql.c -o bfile_example_sql $(TLIBS) -L. -lbfile_ext -L$(DBSQL_DIR)/lib -ldb_sql -ldl
73 else
74 bfile_test: $(TOP)/test/bfile_test_capi.c $(TOP)/include/bfile.h libbfile_ext.so
75 $(TCC) $(TOP)/test/bfile_test_capi.c -o bfile_test_capi $(TLIBS) -L. -lbfile_ext -L$(DBSQL_DIR)/lib -ldb_sql -ldl
76 bfile_example: $(TOP)/examples/bfile_example_capi.c $(TOP)/include/bfile.h libbfile_ext.so
77 $(TCC) $(TOP)/examples/bfile_example_capi.c -o bfile_example_capi $(TLIBS) -L. -lbfile_ext -L$(DBSQL_DIR)/lib -ldb_sql -ldl
78 endif
79 install: libbfile_ext.so $(TOP)/include/bfile.h
80 $(INSTALL) -m 0755 libbfile_ext.so $(DESTDIR)$(libdir)
81 $(INSTALL) -m 0644 $(TOP)/include/bfile.h $(DESTDIR)$(includedir)
82
83 clean:
84 rm -rf *.jpg *.db* libbfile_ext.so bfile_test bfile_example
85
86 # Makefile can not test for ovia. It sould be copy to ovia platform.
87 # The follow target only suit for linux.
88 #
89 ifeq ($(BUILD_OVIA), 0)
90 test: bfile_test
91 env LD_LIBRARY_PATH=.:$(DBSQL_DIR)/lib:$(LD_LIBRARY_PATH) ./bfile_test
92 endif
93
94 ifdef TESTFIXTURE
95 ifdef TEST_DIR
96 tcl_test: $(TOP)/test/bfile.test
97 cp $(TOP)/test/bfile.test $(TEST_DIR)/
98 env LD_LIBRARY_PATH=.:$(DBSQL_DIR)/lib:$(LD_LIBRARY_PATH) $(TESTFIXTURE) $(TEST_DIR)/bfile.test
99 else
100 tcl_test:
101 -echo "Please set the correct fullpath for TEST_DIR"
102 endif
103 else
104 tcl_test:
105 -echo "Please set the correct fullpath for TESTFIXTURE"
106 endif
107
108 run: bfile_example
109 env LD_LIBRARY_PATH=.:$(DBSQL_DIR)/lib:$(LD_LIBRARY_PATH) ./bfile_example
110