2 # (c) 2006 Jan Lehnardt <jan@php.net>
3 # This program is Free Software. See license.txt
6 UNICODE_INCLUDE_DIR ?
= /usr
/include/
7 ERLANG_INCLUDE_DIR ?
= /usr
/lib
/erlang
/driver
8 COUCHDB_INSTALL_DIR ?
= /usr
/local
/couchdb
16 INSTALL ?
= /usr
/bin
/install
18 ANTLR_OBJ_FILES
=Fabric
/antlr
/ANTLRUtil.o Fabric
/antlr
/BitSet.o Fabric
/antlr
/CommonHiddenStreamToken.o Fabric
/antlr
/MismatchedTokenException.o Fabric
/antlr
/RecognitionException.o Fabric
/antlr
/TokenStreamBasicFilter.o Fabric
/antlr
/ASTFactory.o Fabric
/antlr
/CharBuffer.o Fabric
/antlr
/CommonToken.o Fabric
/antlr
/MismatchedUnicodeCharException.o Fabric
/antlr
/String.o Fabric
/antlr
/TokenStreamHiddenTokenFilter.o Fabric
/antlr
/ASTNULLType.o Fabric
/antlr
/CharScanner.o Fabric
/antlr
/InputBuffer.o Fabric
/antlr
/NoViableAltException.o Fabric
/antlr
/Token.o Fabric
/antlr
/TokenStreamRewriteEngine.o Fabric
/antlr
/ASTRefCount.o Fabric
/antlr
/CommonAST.o Fabric
/antlr
/LLkParser.o Fabric
/antlr
/NoViableAltForCharException.o Fabric
/antlr
/TokenBuffer.o Fabric
/antlr
/TokenStreamSelector.o Fabric
/antlr
/BaseAST.o Fabric
/antlr
/CommonASTWithHiddenTokens.o Fabric
/antlr
/MismatchedCharException.o Fabric
/antlr
/Parser.o Fabric
/antlr
/TokenRefCount.o Fabric
/antlr
/TreeParser.o
20 FABRIC_OBJ_FILES
=Fabric
/GeneratedCode
/FabricLexer.o Fabric
/GeneratedCode
/FabricParser.o Fabric
/Fabric.o Fabric
/Element.o Fabric
/NewRuntimeNode.o
22 CPPFLAGS
=-I.
/Fabric
/ -I.
/Fabric
/GeneratedCode
/ -I
$(UNICODE_INCLUDE_DIR
) -I.
/Fabric
/antlr
/ -D_DEBUG
23 LDFLAGS
=-L
$(BUILD_DIR
)/
25 COUCH_DB_BEAM_FILES
=$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_db.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_doc.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_file.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_server.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_stream.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_util.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_btree.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_db_sup.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_fabric.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_log.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_server_sup.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch_table_group.beam
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/mod_couch.beam
30 # copy build/couch-x.x.x -> install/lib/
31 # copy build/couch.boot install/boot
32 # copy startCouchDb ->install/bin
33 # copy couch_erl_driver.so -> install/lib
34 # copy FabricServer => install/bin
36 cp
-R
dist/common
/* $(COUCHDB_INSTALL_DIR
)/
37 mkdir
$(COUCHDB_INSTALL_DIR
)/lib
$(COUCHDB_INSTALL_DIR
)/bin
38 cp
$(BUILD_DIR
)/FabricServer
$(COUCHDB_INSTALL_DIR
)/bin
/
39 cp
dist/unix
/bin
/startCouchDb.sh
$(COUCHDB_INSTALL_DIR
)/bin
/
40 cp
$(BUILD_DIR
)/couch_erl_driver.so
$(COUCHDB_INSTALL_DIR
)/lib
/
41 mv
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf.src
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf
42 .
/dist/unix
/bin
/config.sh
43 mv .
/dist/unix
/couch.ini
$(COUCHDB_INSTALL_DIR
)/
44 mkdir
$(COUCHDB_INSTALL_DIR
)/boot
/
45 cp
$(BUILD_DIR
)/couch.boot
$(COUCHDB_INSTALL_DIR
)/boot
/
50 cp
$(BUILD_DIR
)/FabricServer
$(DIST_DIR
)/
51 cp
$(BUILD_DIR
)/couch_erl_driver.so
$(DIST_DIR
)/
55 couchdb
: host
$(BUILD_DIR
)/couch_erl_driver.so
$(COUCH_DB_BEAM_FILES
) $(BUILD_DIR
)/FabricServer
$(BUILD_DIR
)/couch.boot
56 @echo
"CouchDb has been built successfully!"
59 ifeq ($(strip $(HOST
)),)
60 @echo
"Cannot determine HOST. exiting...";
64 $(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/%.beam
: CouchDb
/%.erl
65 $(ERLC
) -o
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
$<
68 $(BUILD_DIR
)/couch_erl_driver.so
:
70 $(CC
) -rdynamic
-shared
-I
$(ERLANG_INCLUDE_DIR
) CouchDb
/couch_port_driver.c
-L
/usr
/lib
-o
$(BUILD_DIR
)/couch_erl_driver.so
-licuuc
-licudata
-licui18n
74 $(CC
) -bundle
-flat_namespace
-undefined suppress
-I
$(ERLANG_INCLUDE_DIR
) CouchDb
/couch_port_driver.c
-o
$(BUILD_DIR
)/couch_erl_driver.so
75 @echo
"ignore the warning?"
78 $(BUILD_DIR
)/couch.boot
: CouchDb
/couch.rel
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
79 $(ERLC
) -pa
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/ -I
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/ -I CouchDb
/ -o
$(BUILD_DIR
)/ CouchDb
/couch.rel
81 $(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
: CouchDb
/couch.app
82 cp CouchDb
/couch.app
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
86 $(BUILD_DIR
)/FabricServer
: $(BUILD_DIR
)/libfabric.a
87 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) FabricServer
/FabricServer.
cpp -o
$(BUILD_DIR
)/FabricServer
-lfabric
-licuuc
-licui18n
-licudata
88 @echo
"FabricServer done"
90 $(BUILD_DIR
)/FabricTests
: fabric
91 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) Fabric
/FabricTests
/FabricTests.
cpp -o
$(BUILD_DIR
)/FabricTests
-lfabric
-licuuc
-licui18n
-licudata
92 @echo
"Fabric Tests Done"
95 $(BUILD_DIR
)/libfabric.a
: $(FABRIC_OBJ_FILES
) $(ANTLR_OBJ_FILES
)
96 $(AR
) rcs
$(BUILD_DIR
)/libfabric.a Fabric
/*.o Fabric
/GeneratedCode
/*.o Fabric
/antlr
/*.o
99 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Fabric.
cpp -o Fabric
/Fabric.o
102 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Element.
cpp -o Fabric
/Element.o
104 Fabric
/NewRuntimeNode.o
:
105 $(CPP
) -c
$(CPPFLAGS
) Fabric
/NewRuntimeNode.
cpp -o Fabric
/NewRuntimeNode.o
107 Fabric
/GeneratedCode
/%.
cpp:
108 .
/Fabric
/AntlrCodeGen.sh
110 Fabric
/GeneratedCode
/FabricLexer.o
: Fabric
/GeneratedCode
/FabricLexer.
cpp
111 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
113 Fabric
/GeneratedCode
/FabricParser.o
: Fabric
/GeneratedCode
/FabricParser.
cpp
114 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
118 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
127 clean_all
: clean_fabric clean_antlr clean_fabrictest clean_fabricserver
131 rm -f Fabric
/*.o Fabric
/GeneratedCode
/*.o
134 rm -f Fabric
/antlr
/*.o
137 rm -f Fabric
/FabricTest
/FabricTest
140 rm -f FabricServer
/FabricServer
142 .PHONY
: clean clean_all clean_antlr clean_fabricserver clean_fabrictest fabric fabric_server couchdb host
dist