This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
65 lines (47 loc) · 1.55 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
GTEST_DIR ?= external/googletest/googletest
CXX ?= clang++
CXXFLAGS += -std=c++14 -pedantic -Wall -Wextra -Iinclude/ -Isrc/
CC ?= clang
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude/
AR ?= ar
RANLIB ?= ranlib
XCODEBUILD ?= xcodebuild
UNZIP ?= unzip
SOURCES = $(shell find src -name '*.cpp')
OBJECTS = $(SOURCES:.cpp=.o)
LIBRARY = libArbiter.a
TEST_SOURCES = $(shell find test -name '*.cpp') $(GTEST_DIR)/src/gtest-all.cc $(GTEST_DIR)/src/gtest_main.cc
TEST_RUNNER = test/main
TEST_INCLUDES = -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -Isrc/
EXAMPLES = examples/library_folders/library_folders
EXAMPLE_LIBRARY_FOLDERS = $(shell find examples/library_folders -name '*.c')
EXAMPLE_LIBRARY_FOLDERS_OBJECTS = $(EXAMPLE_LIBRARY_FOLDERS:.c=.o)
.PHONY: bindings/swift check docs
all: build
bindings: bindings/swift
bindings/swift:
cd $@ && xcodebuild -scheme Arbiter
build: $(LIBRARY)
check: $(TEST_RUNNER)
$(TEST_RUNNER)
clean:
rm -f $(EXAMPLES)
rm -f $(LIBRARY) $(TEST_RUNNER)
rm -f $(OBJECTS)
rm -rf test/fixtures/carthage-graph/
docs:
doxygen Doxyfile
examples: $(EXAMPLES)
examples/library_folders/library_folders: $(EXAMPLE_LIBRARY_FOLDERS_OBJECTS) $(LIBRARY)
$(CXX) $(CXXFLAGS) $^ -o $@
$(LIBRARY): $(OBJECTS)
$(AR) rcs $@ $^
$(RANLIB) $@
fixtures: test/fixtures/carthage-graph.zip
$(UNZIP) -n -q $^ -d test/fixtures
$(TEST_RUNNER): $(TEST_SOURCES) $(LIBRARY) fixtures
$(CXX) $(CXXFLAGS) $(TEST_SOURCES) $(LIBRARY) -pthread $(TEST_INCLUDES) -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@