This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Makefile
129 lines (107 loc) · 3.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
default: gjstest/internal/cpp/gjstest.bin share
######################################################
# Flags
######################################################
# The prefix into which the user wants to install.
export PREFIX = /usr/local
DEFAULT_DATA_DIR = $(PREFIX)/share/gjstest
# Preprocessor flags.
CPPFLAGS += -I.
CPPFLAGS += -I./third_party/gmock/include
CPPFLAGS += -I./third_party/gmock/gtest/include
CPPFLAGS += -I/usr/include/libxml2
CPPFLAGS += -I/usr/local/opt/libxml2/include/libxml2
CPPFLAGS += -I/usr/local/include
CPPFLAGS += -I$(HOME)/.homebrew/include
CPPFLAGS += -I$(HOME)/.homebrew/opt/libxml2/include/libxml2
CPPFLAGS += -DDEFAULT_DATA_DIR=$(DEFAULT_DATA_DIR)
# Compiler flags.
CXXFLAGS += -DHASH_NAMESPACE=__gnu_cxx
CXXFLAGS += -std=c++11
# Linker flags.
LDFLAGS += -L/usr/local/lib
LDFLAGS += -L$(HOME)/.homebrew/lib
# Fix clock_gettime in timer.cc.
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
CXXFLAGS += -lrt
endif
INSTALL = install
######################################################
# Functions
######################################################
include scripts/cc_rules.mk
include scripts/js_rules.mk
include scripts/proto_rules.mk
######################################################
# Packages
######################################################
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/browser/targets.mk
include gjstest/internal/js/targets.mk
include gjstest/internal/proto/targets.mk
include gjstest/public/matchers/targets.mk
include gjstest/public/targets.mk
include strings/targets.mk
include third_party/cityhash/targets.mk
include util/gtl/targets.mk
include webutil/xml/targets.mk
######################################################
# Data
######################################################
# A directory containing a file called builtin_scripts.deps with one relative
# path per line, and the files defined by those relative paths. These are all
# of the JS files needed at runtime.
share : gjstest/internal/js/use_global_namespace.deps
# Built-in JS files.
for js_file in `cat gjstest/internal/js/use_global_namespace.deps`; do \
mkdir -p share/`dirname $$js_file` || exit 1; \
cp $$js_file share/$$js_file || exit 1; \
done
# Browser CSS.
mkdir -p gjstest/internal/js/browser
cp gjstest/internal/js/browser/browser.css share/gjstest/internal/js/browser/browser.css
######################################################
# 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 : gjstest/internal/cpp/gjstest.bin share
# Binary
$(INSTALL) -m 0755 -d $(PREFIX)/bin
$(INSTALL) -m 0755 gjstest/internal/cpp/gjstest.bin $(PREFIX)/bin/gjstest
# Data
for f in $$(find share -type f); \
do \
DIR=`dirname $$f` || exit 1; \
install -m 0755 -d $(PREFIX)/$$DIR || exit 1; \
install -m 0644 $$f $(PREFIX)/$$f || exit 1; \
done
######################################################
# House-keeping
######################################################
clean :
$(MAKE) -C third_party/gmock/make clean
find . -name '*.bin' -delete
find . -name '*.compile' -delete
find . -name '*.deps' -delete
find . -name '*.generated.h' -delete
find . -name '*.generated.cc' -delete
find . -name '*.header_deps' -delete
find . -name '*.o' -delete
find . -name '*.object_deps' -delete
find . -name '*.pb.cc' -delete
find . -name '*.pb.h' -delete
find . -name '*test.out' -delete
rm -f $(CC_BINARIES)
rm -rf share/