blob: 57e82c50165490c79d38a23ad66ceb4ea5ac925b [file] [log] [blame]
Shinichiro Hamajib69bf8a2015-06-10 14:52:06 +09001# Copyright 2015 Google Inc. All rights reserved
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090015GO_SRCS:=$(wildcard *.go)
16CXX_SRCS:= \
17 ast.cc \
18 dep.cc \
19 eval.cc \
20 exec.cc \
21 file.cc \
22 file_cache.cc \
23 fileutil.cc \
24 func.cc \
25 main.cc \
26 parser.cc \
27 rule.cc \
28 string_piece.cc \
29 string_pool.cc \
30 stringprintf.cc \
31 strutil.cc \
32 value.cc \
33 var.cc
34CXX_TEST_SRCS:= \
35 $(wildcard *_test.cc)
36CXX_OBJS:=$(CXX_SRCS:.cc=.o)
37CXX_TEST_OBJS:=$(CXX_TEST_SRCS:.cc=.o)
38CXX_ALL_OBJS:=$(CXX_SRCS:.cc=.o) $(CXX_TEST_SRCS:.cc=.o)
39CXX_TEST_EXES:=$(CXX_TEST_OBJS:.o=)
40CXXFLAGS:=-g -W -Wall -MMD # -O
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090041
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090042all: kati para ckati $(CXX_TEST_EXES)
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090043
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090044kati: $(GO_SRCS)
Shinichiro Hamaji5ca0ecd2015-04-30 18:30:56 +090045 env $(shell go env) go build -o $@ *.go
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090046
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090047ckati: $(CXX_OBJS)
48 $(CXX) -std=c++11 $(CXXFLAGS) -o $@ $(CXX_OBJS)
49
50$(CXX_ALL_OBJS): %.o: %.cc
51 $(CXX) -c -std=c++11 $(CXXFLAGS) -o $@ $<
52
53$(CXX_TEST_EXES): $(filter-out main.o,$(CXX_OBJS))
54$(CXX_TEST_EXES): %: %.o
55 $(CXX) $^ -o $@
56
57go_test: $(GO_SRCS) para
Shinichiro Hamaji5ca0ecd2015-04-30 18:30:56 +090058 env $(shell go env) go test *.go
59
60para: para.cc
Shinichiro Hamajicedc5c82015-05-13 17:03:20 +090061 $(CXX) -std=c++11 -g -O -W -Wall -MMD -o $@ $<
Fumitoshi Ukaie520f262015-03-31 17:27:03 +090062
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090063test: all go_test
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090064 ruby runtest.rb
65
Shinichiro Hamajibbf6a712015-03-30 17:22:38 +090066clean:
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090067 rm -rf out kati ckati *.o *.d
Shinichiro Hamajibbf6a712015-03-30 17:22:38 +090068
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090069.PHONY: test
Shinichiro Hamaji5ca0ecd2015-04-30 18:30:56 +090070
71-include *.d