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
/couch_rep.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 cp
-R
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
) $(ERLANG_LIB_DIR
)
42 mv
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf.src
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf
43 .
/dist/unix
/bin
/config.sh
44 mv .
/dist/unix
/couch.ini
$(COUCHDB_INSTALL_DIR
)/
45 mkdir
$(COUCHDB_INSTALL_DIR
)/boot
/
46 cp
$(BUILD_DIR
)/couch.boot
$(COUCHDB_INSTALL_DIR
)/boot
/
51 cp
$(BUILD_DIR
)/FabricServer
$(DIST_DIR
)/
52 cp
$(BUILD_DIR
)/couch_erl_driver.so
$(DIST_DIR
)/
56 couchdb
: host
$(BUILD_DIR
)/couch_erl_driver.so
$(COUCH_DB_BEAM_FILES
) $(BUILD_DIR
)/FabricServer
$(BUILD_DIR
)/couch.boot
57 @echo
"CouchDb has been built successfully!"
60 ifeq ($(strip $(HOST
)),)
61 @echo
"Cannot determine HOST. exiting...";
65 $(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/%.beam
: CouchDb
/%.erl
66 $(ERLC
) -o
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
$<
69 $(BUILD_DIR
)/couch_erl_driver.so
:
71 $(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
75 $(CC
) -bundle
-flat_namespace
-undefined suppress
-I
$(ERLANG_INCLUDE_DIR
) CouchDb
/couch_port_driver.c
-L
/usr
/local
/lib
-o
$(BUILD_DIR
)/couch_erl_driver.so
-licudata
-licuuc
-licui18n
76 @echo
"ignore the warning?"
79 $(BUILD_DIR
)/couch.boot
: CouchDb
/couch.rel
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
80 $(ERLC
) -pa
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/ -I
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/ -I CouchDb
/ -o
$(BUILD_DIR
)/ CouchDb
/couch.rel
82 $(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
: CouchDb
/couch.app
83 cp CouchDb
/couch.app
$(BUILD_DIR
)/couch-
$(COUCHDB_VERSION
)/ebin
/couch.app
87 $(BUILD_DIR
)/FabricServer
: $(BUILD_DIR
)/libfabric.a
88 ifeq ($(COUCH_BIG_ENDIAN
),true
)
89 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) FabricServer
/FabricServer.
cpp -DCOUCH_BIG_ENDIAN
-o
$(BUILD_DIR
)/FabricServer
-lfabric
-licuuc
-licui18n
-licudata
91 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) FabricServer
/FabricServer.
cpp -o
$(BUILD_DIR
)/FabricServer
-lfabric
-licuuc
-licui18n
-licudata
93 @echo
"FabricServer done"
96 $(BUILD_DIR
)/FabricTests
: fabric
97 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) Fabric
/FabricTests
/FabricTests.
cpp -o
$(BUILD_DIR
)/FabricTests
-lfabric
-licuuc
-licui18n
-licudata
98 @echo
"Fabric Tests Done"
101 $(BUILD_DIR
)/libfabric.a
: $(FABRIC_OBJ_FILES
) $(ANTLR_OBJ_FILES
)
102 $(AR
) rcs
$(BUILD_DIR
)/libfabric.a Fabric
/*.o Fabric
/GeneratedCode
/*.o Fabric
/antlr
/*.o
105 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Fabric.
cpp -o Fabric
/Fabric.o
108 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Element.
cpp -o Fabric
/Element.o
110 Fabric
/NewRuntimeNode.o
:
111 $(CPP
) -c
$(CPPFLAGS
) Fabric
/NewRuntimeNode.
cpp -o Fabric
/NewRuntimeNode.o
113 Fabric
/GeneratedCode
/%.
cpp:
114 .
/Fabric
/AntlrCodeGen.sh
116 Fabric
/GeneratedCode
/FabricLexer.o
: Fabric
/GeneratedCode
/FabricLexer.
cpp
117 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
119 Fabric
/GeneratedCode
/FabricParser.o
: Fabric
/GeneratedCode
/FabricParser.
cpp
120 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
124 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
133 clean_all
: clean_fabric clean_antlr clean_fabrictest clean_fabricserver
137 rm -f Fabric
/*.o Fabric
/GeneratedCode
/*
140 rm -f Fabric
/antlr
/*.o
143 rm -f Fabric
/FabricTest
/FabricTest
146 rm -f FabricServer
/FabricServer
148 .PHONY
: clean clean_all clean_antlr clean_fabricserver clean_fabrictest fabric fabric_server couchdb host
dist