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
17 INSTALL ?
= /usr
/bin
/install
19 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
21 FABRIC_OBJ_FILES
=Fabric
/GeneratedCode
/FabricLexer.o Fabric
/GeneratedCode
/FabricParser.o Fabric
/Fabric.o Fabric
/Element.o Fabric
/NewRuntimeNode.o
23 CPPFLAGS
=-I.
/Fabric
/ -I.
/Fabric
/GeneratedCode
/ -I
$(UNICODE_INCLUDE_DIR
) -I.
/Fabric
/antlr
/ -D_DEBUG
24 LDFLAGS
=-L
$(BUILD_DIR
)/
26 #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 cp
-R
dist/common
/* $(COUCHDB_INSTALL_DIR
)/
31 mkdir
$(COUCHDB_INSTALL_DIR
)/lib
$(COUCHDB_INSTALL_DIR
)/bin
32 cp
$(BUILD_DIR
)/FabricServer
$(COUCHDB_INSTALL_DIR
)/bin
/
33 cp
dist/unix
/bin
/startCouchDb.sh
$(COUCHDB_INSTALL_DIR
)/bin
/
34 cp
$(BUILD_DIR
)/couch_erl_driver.so
$(COUCHDB_INSTALL_DIR
)/lib
/
35 mv
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf.src
$(COUCHDB_INSTALL_DIR
)/couch_httpd.conf
36 .
/dist/unix
/bin
/config.sh
37 mv .
/dist/unix
/couch.ini
$(COUCHDB_INSTALL_DIR
)/
38 mkdir
$(COUCHDB_INSTALL_DIR
)/boot
/
39 cp couch.boot
$(COUCHDB_INSTALL_DIR
)/boot
/
40 $(ERL
) -noshell
-run build_couch output_full_libs
$(COUCHDB_INSTALL_DIR
)
43 cp
$(BUILD_DIR
)/FabricServer
$(DIST_DIR
)/
44 cp
$(BUILD_DIR
)/couch_erl_driver.so
$(DIST_DIR
)/
48 #couchdb: host $(BUILD_DIR)/couch_erl_driver.so $(COUCH_DB_BEAM_FILES) $(BUILD_DIR)/FabricServer $(BUILD_DIR)/couch.app
49 couchdb
: host
$(BUILD_DIR
)/couch_erl_driver.so
$(BUILD_DIR
)/FabricServer build_couch.beam couch.boot
50 @echo
"CouchDb has been built successfully!"
53 ifeq ($(strip $(HOST
)),)
54 @echo
"Cannot determine HOST. exiting...";
58 #$(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/%.beam: CouchDb/%.erl
59 # $(ERLC) -o $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin $<
62 $(BUILD_DIR
)/couch_erl_driver.so
:
64 $(CC
) -w
-rdynamic
-shared
-I
$(ERLANG_INCLUDE_DIR
) CouchDb
/couch_erl_driver.c
-L
/usr
/lib
-o
$(BUILD_DIR
)/couch_erl_driver.so
-licuuc
-licudata
-licui18n
68 $(CC
) -w
-bundle
-flat_namespace
-undefined suppress
-I
$(ERLANG_INCLUDE_DIR
) CouchDb
/couch_erl_driver.c
-L
/usr
/local
/lib
-o
$(BUILD_DIR
)/couch_erl_driver.so
-licudata
-licuuc
-licui18n
71 # $(BUILD_DIR)/couch.boot: CouchDb/couch.rel $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/couch.app
72 # $(ERLC) -pa $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/ -I $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/ -I couch_inets/ -I $(ERLANG_LIB_DIR) -I CouchDb/ -o $(BUILD_DIR)/ CouchDb/couch.rel
76 $(ERL
) -noshell
-run build_couch compile_all
78 # CouchDb/couch.app CouchDb/couch.rel: build_couch.beam version
79 # $(ERL) -noshell -run build_couch compile_all
80 # $(ERL) -noshell -run build_couch make_app_rel_files
83 build_couch.beam
: build_couch.erl
84 $(ERLC
) build_couch.erl
86 # $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/couch.app: CouchDb/couch.app
87 # cp CouchDb/couch.app $(BUILD_DIR)/couch-$(COUCHDB_VERSION)/ebin/couch.app
95 $(BUILD_DIR
)/FabricServer
: $(BUILD_DIR
)/libfabric.a
96 ifeq ($(COUCH_BIG_ENDIAN
),true
)
97 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) FabricServer
/FabricServer.
cpp -DCOUCH_BIG_ENDIAN
-o
$(BUILD_DIR
)/FabricServer
-lfabric
-licuuc
-licui18n
-licudata
99 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) FabricServer
/FabricServer.
cpp -o
$(BUILD_DIR
)/FabricServer
-lfabric
-licuuc
-licui18n
-licudata
101 @echo
"FabricServer done"
104 $(BUILD_DIR
)/FabricTests
: fabric
105 $(CPP
) $(CPPFLAGS
) $(LDFLAGS
) Fabric
/FabricTests
/FabricTests.
cpp -o
$(BUILD_DIR
)/FabricTests
-lfabric
-licuuc
-licui18n
-licudata
106 @echo
"Fabric Tests Done"
109 $(BUILD_DIR
)/libfabric.a
: $(FABRIC_OBJ_FILES
) $(ANTLR_OBJ_FILES
)
110 $(AR
) rcs
$(BUILD_DIR
)/libfabric.a Fabric
/*.o Fabric
/GeneratedCode
/*.o Fabric
/antlr
/*.o
113 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Fabric.
cpp -o Fabric
/Fabric.o
116 $(CPP
) -c
$(CPPFLAGS
) Fabric
/Element.
cpp -o Fabric
/Element.o
118 Fabric
/NewRuntimeNode.o
:
119 $(CPP
) -c
$(CPPFLAGS
) Fabric
/NewRuntimeNode.
cpp -o Fabric
/NewRuntimeNode.o
121 Fabric
/GeneratedCode
/%.
cpp:
122 .
/Fabric
/AntlrCodeGen.sh
124 Fabric
/GeneratedCode
/FabricLexer.o
: Fabric
/GeneratedCode
/FabricLexer.
cpp
125 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
127 Fabric
/GeneratedCode
/FabricParser.o
: Fabric
/GeneratedCode
/FabricParser.
cpp
128 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
132 $(CPP
) -c
$(CPPFLAGS
) $< -o
$@
141 clean_all
: clean_fabric clean_antlr clean_fabrictest clean_fabricserver
148 rm -f Fabric
/antlr
/*.o
151 rm -f Fabric
/FabricTest
/FabricTest
154 rm -f FabricServer
/FabricServer
157 rm -f Fabric
/GeneratedCode
/*
159 .PHONY
: clean clean_all clean_antlr clean_fabricserver clean_fabrictest fabric fabric_server couchdb host
dist distclean