Skip to content
Permalink
Browse files

Gave our build setup a makeover.

Fixes issue 8.
  • Loading branch information...
jacobsa committed Oct 6, 2011
1 parent 44698e4 commit dc322b9e923f58db18e3ca79874cd6493de90c98
Showing with 1,098 additions and 772 deletions.
  1. +8 −9 .gitignore
  2. +65 −104 Makefile
  3. +0 −47 base/Makefile
  4. +71 −0 base/targets.mk
  5. +0 −5 depend_target.mk
  6. +0 −44 file/Makefile
  7. +7 −0 file/targets.mk
  8. +0 −152 gjstest/internal/cpp/Makefile
  9. 0 gjstest/internal/cpp/{gjstest_main.cc → gjstest.cc}
  10. +76 −0 gjstest/internal/cpp/targets.mk
  11. +0 −52 gjstest/internal/integration_tests/Makefile
  12. +25 −0 gjstest/internal/integration_tests/targets.mk
  13. +0 −33 gjstest/internal/js/Makefile
  14. +0 −28 gjstest/internal/js/browser/Makefile
  15. +70 −0 gjstest/internal/js/targets.mk
  16. +0 −42 gjstest/internal/proto/Makefile
  17. +4 −0 gjstest/internal/proto/targets.mk
  18. +0 −31 gjstest/public/Makefile
  19. +2 −2 gjstest/public/actions.js
  20. +0 −35 gjstest/public/matchers/Makefile
  21. +73 −0 gjstest/public/matchers/targets.mk
  22. +59 −0 gjstest/public/targets.mk
  23. +0 −6 js_test.mk
  24. +38 −0 scripts/cc_binary_build.sh
  25. +49 −0 scripts/cc_library_make_header_deps_file.sh
  26. +54 −0 scripts/cc_library_make_object_deps_file.sh
  27. +159 −0 scripts/cc_rules.mk
  28. +26 −0 scripts/cc_test_run.sh
  29. +38 −0 scripts/js_library_check_compile.sh
  30. +48 −0 scripts/js_library_make_deps_file.sh
  31. +93 −0 scripts/js_rules.mk
  32. +41 −0 scripts/js_test_run.sh
  33. +31 −0 scripts/proto_rules.mk
  34. +0 −47 strings/Makefile
  35. +12 −0 strings/targets.mk
  36. +0 −47 third_party/cityhash/Makefile
  37. 0 third_party/cityhash/{city-test.cc → city_test.cc}
  38. +19 −0 third_party/cityhash/targets.mk
  39. +0 −11 tools.mk
  40. +3 −0 util/gtl/targets.mk
  41. +5 −0 util/hash/targets.mk
  42. +0 −77 webutil/xml/Makefile
  43. +22 −0 webutil/xml/targets.mk
@@ -1,15 +1,14 @@
# Build outputs
# Things built by make.
*.a
*.bin
*.compile
*.deps
*.header_deps
*.o

# Things built by make.
*test.bin
bin/
*.object_deps
*test.out
share/

# Generated proto bufer code.
# Generated proto buffer code.
*.pb.cc
*.pb.h

# vim noise
.*.swp
169 Makefile
@@ -1,126 +1,59 @@
PROJECT_ROOT = .
default: bin/gjstest share
default: gjstest/internal/cpp/gjstest.bin share

# Tools and flags.
include $(PROJECT_ROOT)/tools.mk
######################################################
# Flags
######################################################

# The prefix into which the user wants to install.
export PREFIX = /usr/local
DEFAULT_DATA_DIR = $(PREFIX)/share/gjstest

UNAME := $(shell uname)
# Preprocessor flags.
CPPFLAGS += -I.
CPPFLAGS += -I/usr/include/libxml2
CPPFLAGS += -DDEFAULT_DATA_DIR=$(DEFAULT_DATA_DIR)

# Compiler flags.
CXXFLAGS += -DHASH_NAMESPACE=__gnu_cxx

# Fix clock_gettime in timer.cc.
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
# For clock_gettime in timer.cc.
CXXFLAGS += -lrt
endif

######################################################
# House-keeping
######################################################

SUBDIRS := \
base \
file \
gjstest/internal/cpp \
gjstest/internal/integration_tests \
gjstest/internal/js \
gjstest/internal/proto \
gjstest/public \
gjstest/public/matchers \
strings \
third_party/cityhash \
webutil/xml \

clean :
rm -f bin/gjstest
rm -rf share/
for subdir in $(SUBDIRS); \
do \
echo "Cleaning in $$subdir"; \
$(MAKE) -C $$subdir clean || exit 1; \
done
find . -name '*.a' -delete
find . -name '*.o' -delete
find . -name '*test.bin' -delete

depend :
# Make sure proto buffer generated headers exist.
$(MAKE) -C gjstest/internal/proto named_scripts.pb.h

for subdir in $(SUBDIRS); \
do \
echo "Making depend in $$subdir"; \
$(MAKE) -C $$subdir depend || exit 1; \
done

test : \
bin/gjstest \
gjstest/internal/cpp/cpp.a \
share
for subdir in $(SUBDIRS); \
do \
echo "Making test in $$subdir"; \
$(MAKE) -C $$subdir test || exit 1; \
done
INSTALL = install

######################################################
# Sub-packages
# Functions
######################################################

base/base.a :
$(MAKE) -C base base.a

file/file.a :
$(MAKE) -C file file.a

gjstest/internal/cpp/cpp.a : gjstest/internal/proto/named_scripts.pb.h
$(MAKE) -C gjstest/internal/cpp cpp.a

gjstest/internal/cpp/gjstest_main.a : gjstest/internal/proto/named_scripts.pb.h
$(MAKE) -C gjstest/internal/cpp gjstest_main.a

gjstest/internal/proto/named_scripts.pb.h :
$(MAKE) -C gjstest/internal/proto named_scripts.pb.h

gjstest/internal/proto/proto.a :
$(MAKE) -C gjstest/internal/proto proto.a

strings/strings.a :
$(MAKE) -C strings strings.a

third_party/cityhash/cityhash.a :
$(MAKE) -C third_party/cityhash cityhash.a

webutil/xml/xml.a :
$(MAKE) -C webutil/xml xml.a

.PHONY: \
base/base.a \
file/file.a \
gjstest/internal/cpp/gjstest_main.a \
gjstest/internal/proto/named_scripts.pb.h \
gjstest/internal/proto/proto.a \
strings/strings.a \
third_party/cityhash/cityhash.a \
webutil/xml/xml.a
include scripts/cc_rules.mk
include scripts/js_rules.mk
include scripts/proto_rules.mk

######################################################
# Binaries
# Packages
######################################################

bin/gjstest: \
gjstest/internal/cpp/gjstest_main.a \
base/base.a \
file/file.a \
gjstest/internal/proto/proto.a \
strings/strings.a \
third_party/cityhash/cityhash.a \
webutil/xml/xml.a
mkdir -p bin/
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ -lglog -lv8 -lgflags -lprotobuf -lre2 -lxml2
include base/targets.mk
include file/targets.mk
include gjstest/internal/cpp/targets.mk
include gjstest/internal/integration_tests/targets.mk
include gjstest/internal/js/targets.mk
include gjstest/internal/proto/targets.mk
include gjstest/public/targets.mk
include gjstest/public/matchers/targets.mk
include strings/targets.mk
include third_party/cityhash/targets.mk
include util/gtl/targets.mk
include util/hash/targets.mk
include webutil/xml/targets.mk

######################################################
# Data
#
# TODO(jacobsa): Make this a .binarypb target. See issue 9.
######################################################

SHARE_DATA = \
@@ -163,17 +96,45 @@ share :

.PHONY : share

######################################################
# Collections
######################################################

binaries : $(CC_BINARIES)
compilation_tests : $(COMPILATION_TESTS)
compile : binaries compilation_tests

js_tests : $(JS_TESTS)
cc_tests : $(CC_TESTS)
test : js_tests cc_tests

######################################################
# Installation
######################################################

install : bin/gjstest share
install : gjstest/internal/cpp/gjstest.bin share
$(INSTALL) -m 0755 -d $(PREFIX)/bin
$(INSTALL) -m 0755 -d $(PREFIX)/share
$(INSTALL) -m 0755 bin/gjstest $(PREFIX)/bin/gjstest
$(INSTALL) -m 0755 gjstest/internal/cpp/gjstest.bin $(PREFIX)/bin/gjstest
for f in $$(find share -type f); \
do \
DIR=`dirname $$f`; \
install -m 0755 -d $(PREFIX)/$$DIR; \
install -m 0644 $$f $(PREFIX)/$$f; \
done

######################################################
# House-keeping
######################################################

clean :
find . -name '*.compile' -delete
find . -name '*.deps' -delete
find . -name '*.header_deps' -delete
find . -name '*.object_deps' -delete
find . -name '*.pb.h' -delete
find . -name '*.pb.cc' -delete
find . -name '*test.out' -delete
find . -name '*.o' -delete
rm -f $(CC_BINARIES)
rm -rf share/

This file was deleted.

@@ -0,0 +1,71 @@
$(eval $(call hdr_only_cc_library, \
base/basictypes, \
base/integral_types \
))

$(eval $(call cc_library, \
base/callback, \
base/logging \
))

$(eval $(call hdr_only_cc_library, \
base/callback-types, \
base/callback \
))

$(eval $(call hdr_only_cc_library, \
base/integral_types, \
))

$(eval $(call hdr_only_cc_library, \
base/logging, \
))

$(eval $(call hdr_only_cc_library, \
base/macros, \
base/type_traits \
))

$(eval $(call hdr_only_cc_library, \
base/scoped_ptr, \
base/basictypes \
base/macros \
))

$(eval $(call hdr_only_cc_library, \
base/stl_decl, \
base/stl_decl_linux \
base/stl_decl_osx \
))

$(eval $(call hdr_only_cc_library, \
base/stl_decl_linux, \
))

$(eval $(call hdr_only_cc_library, \
base/stl_decl_osx, \
))

$(eval $(call cc_library, \
base/stringpiece, \
))

$(eval $(call cc_library, \
base/stringprintf, \
))

$(eval $(call hdr_only_cc_library, \
base/template_util, \
))

$(eval $(call cc_library, \
base/timer, \
base/integral_types \
base/logging \
base/macros \
))

$(eval $(call hdr_only_cc_library, \
base/type_traits, \
base/template_util \
))

This file was deleted.

0 comments on commit dc322b9

Please sign in to comment.
You can’t perform that action at this time.