diff options
author | 2015-02-15 10:54:07 -0800 | |
---|---|---|
committer | 2015-02-15 10:54:07 -0800 | |
commit | 61b910f6381cf1a924759abd596d72dfd4b5154f (patch) | |
tree | 90895b50c65853d86059043d6d8081fcab2d0eaa /templates/Makefile.template | |
parent | bb62706f8428357d3f96d6de9e65c8fc6b439b9c (diff) |
Add support for out of tree builds
Auto-dependency building doesn't do this (yet)
Diffstat (limited to 'templates/Makefile.template')
-rw-r--r-- | templates/Makefile.template | 163 |
1 files changed, 86 insertions, 77 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template index b9ae217054..5039b4b46b 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -27,6 +27,15 @@ SYSTEM = $(HOST_SYSTEM) endif +ifndef BUILDDIR +BUILDDIR = . +endif + +BINDIR = $(BUILDDIR)/bins +OBJDIR = $(BUILDDIR)/objs +LIBDIR = $(BUILDDIR)/libs +GENDIR = $(BUILDDIR)/gens + # Configurations VALID_CONFIG_opt = 1 @@ -261,7 +270,7 @@ endif ifeq ($(HAS_SYSTEM_ZLIB),false) ifeq ($(HAS_EMBEDDED_ZLIB),true) -ZLIB_DEP = libs/$(CONFIG)/zlib/libz.a +ZLIB_DEP = $(LIBDIR)/$(CONFIG)/zlib/libz.a CPPFLAGS += -Ithird_party/zlib LDFLAGS += -Llibs/$(CONFIG)/zlib else @@ -271,8 +280,8 @@ endif ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),false) ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) -OPENSSL_DEP = libs/$(CONFIG)/openssl/libssl.a -OPENSSL_MERGE_LIBS += libs/$(CONFIG)/openssl/libssl.a libs/$(CONFIG)/openssl/libcrypto.a +OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a +OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/openssl/libcrypto.a CPPFLAGS += -Ithird_party/openssl/include LDFLAGS += -Llibs/$(CONFIG)/openssl LIBS_SECURE = dl @@ -287,10 +296,10 @@ LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) ifeq ($(HAS_SYSTEM_PROTOBUF),false) ifeq ($(HAS_EMBEDDED_PROTOBUF),true) -PROTOBUF_DEP = libs/$(CONFIG)/protobuf/libprotobuf.a +PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a CPPFLAGS += -Ithird_party/protobuf/src LDFLAGS += -Llibs/$(CONFIG)/protobuf -PROTOC = bins/$(CONFIG)/protobuf/protoc +PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc else NO_PROTOBUF = true endif @@ -312,7 +321,7 @@ endif PROTOC_PLUGINS=\ % for tgt in targets: % if tgt.build == 'protoc': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -320,7 +329,7 @@ ifeq ($(DEP_MISSING),) all: static shared\ % for tgt in targets: % if tgt.build == 'all': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -408,7 +417,7 @@ stop: @false % for tgt in targets: -${tgt.name}: bins/$(CONFIG)/${tgt.name} +${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name} % endfor run_dep_checks: @@ -418,15 +427,15 @@ run_dep_checks: $(PROTOBUF_CHECK_CMD) || true $(PROTOC_CHECK_CMD) || true -libs/$(CONFIG)/zlib/libz.a: +$(LIBDIR)/$(CONFIG)/zlib/libz.a: $(E) "[MAKE] Building zlib" $(Q)(cd third_party/zlib ; CC="$(CC)" CFLAGS="-fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG))" ./configure --static) $(Q)$(MAKE) -C third_party/zlib clean $(Q)$(MAKE) -C third_party/zlib - $(Q)mkdir -p libs/$(CONFIG)/zlib - $(Q)cp third_party/zlib/libz.a libs/$(CONFIG)/zlib + $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/zlib + $(Q)cp third_party/zlib/libz.a $(LIBDIR)/$(CONFIG)/zlib -libs/$(CONFIG)/openssl/libssl.a: +$(LIBDIR)/$(CONFIG)/openssl/libssl.a: $(E) "[MAKE] Building openssl for $(SYSTEM)" ifeq ($(SYSTEM),Darwin) $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc $(OPENSSL_CONFIG_$(CONFIG))) @@ -435,30 +444,30 @@ else endif $(Q)$(MAKE) -C third_party/openssl clean $(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl - $(Q)mkdir -p libs/$(CONFIG)/openssl - $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a libs/$(CONFIG)/openssl + $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl + $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl third_party/protobuf/configure: $(E) "[AUTOGEN] Preparing protobuf" $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) -libs/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure +$(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure $(E) "[MAKE] Building protobuf" $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="$(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static) $(Q)$(MAKE) -C third_party/protobuf clean $(Q)$(MAKE) -C third_party/protobuf - $(Q)mkdir -p libs/$(CONFIG)/protobuf - $(Q)mkdir -p bins/$(CONFIG)/protobuf - $(Q)cp third_party/protobuf/src/.libs/libprotoc.a libs/$(CONFIG)/protobuf - $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a libs/$(CONFIG)/protobuf - $(Q)cp third_party/protobuf/src/protoc bins/$(CONFIG)/protobuf + $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf + $(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf static: static_c static_cxx static_c: \ % for lib in libs: % if lib.build == 'all' and lib.language == 'c': - libs/$(CONFIG)/lib${lib.name}.a\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ % endif % endfor @@ -466,7 +475,7 @@ static_c: \ static_cxx: \ % for lib in libs: % if lib.build == 'all' and lib.language == 'c++': - libs/$(CONFIG)/lib${lib.name}.a\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ % endif % endfor @@ -476,7 +485,7 @@ shared: shared_c shared_cxx shared_c: \ % for lib in libs: % if lib.build == 'all' and lib.language == 'c': - libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ % endif % endfor @@ -484,7 +493,7 @@ shared_c: \ shared_cxx: \ % for lib in libs: % if lib.build == 'all' and lib.language == 'c++': - libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ % endif % endfor @@ -494,7 +503,7 @@ privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: \ % for lib in libs: % if lib.build == 'private' and lib.language == 'c': - libs/$(CONFIG)/lib${lib.name}.a\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ % endif % endfor @@ -502,7 +511,7 @@ privatelibs_c: \ privatelibs_cxx: \ % for lib in libs: % if lib.build == 'private' and lib.language == 'c++': - libs/$(CONFIG)/lib${lib.name}.a\ + $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ % endif % endfor @@ -512,7 +521,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c\ % for tgt in targets: % if tgt.build == 'test' and not tgt.language == 'c++': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -520,7 +529,7 @@ buildtests_c: privatelibs_c\ buildtests_cxx: privatelibs_cxx\ % for tgt in targets: % if tgt.build == 'test' and tgt.language == 'c++': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -548,7 +557,7 @@ test_cxx: buildtests_cxx tools: privatelibs\ % for tgt in targets: % if tgt.build == 'tool': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -556,7 +565,7 @@ tools: privatelibs\ buildbenchmarks: privatelibs\ % for tgt in targets: % if tgt.build == 'benchmark': - bins/$(CONFIG)/${tgt.name}\ + $(BINDIR)/$(CONFIG)/${tgt.name}\ % endif % endfor @@ -580,7 +589,7 @@ ifeq ($(CONFIG),opt) % if lib.language == "c": % if lib.build == "all": $(E) "[STRIP] Stripping lib${lib.name}.a" - $(Q) $(STRIP) libs/$(CONFIG)/lib${lib.name}.a + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a % endif % endif % endfor @@ -592,7 +601,7 @@ ifeq ($(CONFIG),opt) % if lib.language == "c++": % if lib.build == "all": $(E) "[STRIP] Stripping lib${lib.name}.a" - $(Q) $(STRIP) libs/$(CONFIG)/lib${lib.name}.a + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a % endif % endif % endfor @@ -604,7 +613,7 @@ ifeq ($(CONFIG),opt) % if lib.language == "c": % if lib.build == "all": $(E) "[STRIP] Stripping lib${lib.name}.so" - $(Q) $(STRIP) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) % endif % endif % endfor @@ -616,7 +625,7 @@ ifeq ($(CONFIG),opt) % if lib.language == "c++": % if lib.build == "all": $(E) "[STRIP] Stripping lib${lib.name}.so" - $(Q) $(STRIP) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) % endif % endif % endfor @@ -624,9 +633,9 @@ endif % for p in protos: ifeq ($(NO_PROTOC),true) -gens/${p}.pb.cc: protoc_dep_error +$(GENDIR)/${p}.pb.cc: protoc_dep_error else -gens/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) +$(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< @@ -634,22 +643,22 @@ endif % endfor -objs/$(CONFIG)/%.o : %.c +$(OBJDIR)/$(CONFIG)/%.o : %.c $(E) "[C] Compiling $<" $(Q) mkdir -p `dirname $@` $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -objs/$(CONFIG)/%.o : gens/%.pb.cc +$(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc $(E) "[CXX] Compiling $<" $(Q) mkdir -p `dirname $@` $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -objs/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc +$(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc $(E) "[HOSTCXX] Compiling $<" $(Q) mkdir -p `dirname $@` $(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -objs/$(CONFIG)/%.o : %.cc +$(OBJDIR)/$(CONFIG)/%.o : %.cc $(E) "[CXX] Compiling $<" $(Q) mkdir -p `dirname $@` $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< @@ -678,7 +687,7 @@ install-static_c: static_c strip-static_c % if lib.language == "c": % if lib.build == "all": $(E) "[INSTALL] Installing lib${lib.name}.a" - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a % endif % endif % endfor @@ -688,7 +697,7 @@ install-static_cxx: static_cxx strip-static_cxx % if lib.language == "c++": % if lib.build == "all": $(E) "[INSTALL] Installing lib${lib.name}.a" - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a % endif % endif % endfor @@ -699,11 +708,11 @@ install-shared_c: shared_c strip-shared_c % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) libs/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a else $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so endif @@ -723,11 +732,11 @@ install-shared_cxx: shared_cxx strip-shared_cxx % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) libs/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a else $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) ifneq ($(SYSTEM),Darwin) $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so endif @@ -780,7 +789,7 @@ PUBLIC_HEADERS_C += \\ % endfor % endif -LIB${lib.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC)))) +LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC)))) ## If the library requires OpenSSL with ALPN, let's add some restrictions. % if lib.get('secure', True): @@ -788,13 +797,13 @@ ifeq ($(NO_SECURE),true) # You can't build secure libraries if you don't have OpenSSL with ALPN. -libs/$(CONFIG)/lib${lib.name}.a: openssl_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) -libs/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error +$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error else -libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error endif % endif @@ -805,13 +814,13 @@ ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -libs/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) -libs/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error +$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error else -libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error endif % endif @@ -827,7 +836,7 @@ ${src}: $(OPENSSL_DEP) % endfor endif -libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ +$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ ## The else here corresponds to the if secure earlier. % else: % if lib.language == 'c++': @@ -835,20 +844,20 @@ ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -libs/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) -libs/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error +$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error else -libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error +$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error endif % endif else % endif -libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ +$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ % endif % if lib.language == 'c++': $(PROTOBUF_DEP)\ @@ -856,21 +865,21 @@ libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ $(LIB${lib.name.upper()}_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f libs/$(CONFIG)/lib${lib.name}.a - $(Q) $(AR) rcs libs/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a + $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) % if lib.get('baselib', False): % if lib.get('secure', True): $(Q) rm -rf tmp-merge $(Q) mkdir tmp-merge $(Q) ( cd tmp-merge ; $(AR) x ../libs/$(CONFIG)/lib${lib.name}.a ) $(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge ; <%text>ar x ../$${l}</%text> ) ; done - $(Q) rm -f libs/$(CONFIG)/lib${lib.name}.a tmp-merge/__.SYMDEF* - $(Q) ar rcs libs/$(CONFIG)/lib${lib.name}.a tmp-merge/* + $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge/__.SYMDEF* + $(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge/* $(Q) rm -rf tmp-merge % endif % endif ifeq ($(SYSTEM),Darwin) - $(Q) ranlib libs/$(CONFIG)/lib${lib.name}.a + $(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a endif <% @@ -890,7 +899,7 @@ endif mingw_lib_deps = ' $(ZLIB_DEP)' for dep in lib.get('deps', []): libs = libs + ' -l' + dep - lib_deps = lib_deps + ' libs/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' + lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' mingw_libs = mingw_libs + ' -l' + dep + '-imp' mingw_lib_deps = mingw_lib_deps + 'libs/$(CONFIG)/' + dep + '.$(SHARED_EXT)' @@ -944,7 +953,7 @@ endif % for src in lib.src: % if not proto_re.match(src): -objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ +$(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ % for src2 in lib.src: % if proto_re.match(src2): ${proto_to_cc(src2)}\ @@ -963,14 +972,14 @@ ${tgt.name.upper()}_SRC = \\ % endfor -${tgt.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) +${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) % if tgt.get('secure', True): ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. -bins/$(CONFIG)/${tgt.name}: openssl_dep_error +$(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error else @@ -990,16 +999,16 @@ ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins if you don't have protobuf 3.0.0+. -bins/$(CONFIG)/${tgt.name}: protobuf_dep_error +$(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error else -bins/$(CONFIG)/${tgt.name}: $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ +$(BINDIR)/$(CONFIG)/${tgt.name}: $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ % else: -bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ +$(BINDIR)/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ % endif % for dep in tgt.deps: - libs/$(CONFIG)/lib${dep}.a\ + $(LIBDIR)/$(CONFIG)/lib${dep}.a\ % endfor % if tgt.language == "c++": @@ -1023,7 +1032,7 @@ bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ $(Q) $(LD) $(LDFLAGS) $(${tgt.name.upper()}_OBJS)\ % endif % for dep in tgt.deps: - libs/$(CONFIG)/lib${dep}.a\ + $(LIBDIR)/$(CONFIG)/lib${dep}.a\ % endfor % if tgt.language == "c++": % if tgt.build == 'protoc': @@ -1042,7 +1051,7 @@ bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ % elif tgt.get('secure', True): $(LDLIBS_SECURE)\ % endif - -o bins/$(CONFIG)/${tgt.name} + -o $(BINDIR)/$(CONFIG)/${tgt.name} % if tgt.build == 'protoc': endif @@ -1053,9 +1062,9 @@ endif % endif % for src in tgt.src: -objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ +$(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ % for dep in tgt.deps: - libs/$(CONFIG)/lib${dep}.a\ + $(LIBDIR)/$(CONFIG)/lib${dep}.a\ % endfor % endfor |