Shinichiro Hamaji | b69bf8a | 2015-06-10 14:52:06 +0900 | [diff] [blame] | 1 | # 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 Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 15 | GO_SRCS:=$(wildcard *.go) |
| 16 | CXX_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 |
| 34 | CXX_TEST_SRCS:= \ |
| 35 | $(wildcard *_test.cc) |
| 36 | CXX_OBJS:=$(CXX_SRCS:.cc=.o) |
| 37 | CXX_TEST_OBJS:=$(CXX_TEST_SRCS:.cc=.o) |
| 38 | CXX_ALL_OBJS:=$(CXX_SRCS:.cc=.o) $(CXX_TEST_SRCS:.cc=.o) |
| 39 | CXX_TEST_EXES:=$(CXX_TEST_OBJS:.o=) |
| 40 | CXXFLAGS:=-g -W -Wall -MMD # -O |
Fumitoshi Ukai | 119dc91 | 2015-03-30 16:52:41 +0900 | [diff] [blame] | 41 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 42 | all: kati para ckati $(CXX_TEST_EXES) |
Fumitoshi Ukai | 119dc91 | 2015-03-30 16:52:41 +0900 | [diff] [blame] | 43 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 44 | kati: $(GO_SRCS) |
Shinichiro Hamaji | 5ca0ecd | 2015-04-30 18:30:56 +0900 | [diff] [blame] | 45 | env $(shell go env) go build -o $@ *.go |
Fumitoshi Ukai | 119dc91 | 2015-03-30 16:52:41 +0900 | [diff] [blame] | 46 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 47 | ckati: $(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 | |
| 57 | go_test: $(GO_SRCS) para |
Shinichiro Hamaji | 5ca0ecd | 2015-04-30 18:30:56 +0900 | [diff] [blame] | 58 | env $(shell go env) go test *.go |
| 59 | |
| 60 | para: para.cc |
Shinichiro Hamaji | cedc5c8 | 2015-05-13 17:03:20 +0900 | [diff] [blame] | 61 | $(CXX) -std=c++11 -g -O -W -Wall -MMD -o $@ $< |
Fumitoshi Ukai | e520f26 | 2015-03-31 17:27:03 +0900 | [diff] [blame] | 62 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 63 | test: all go_test |
Fumitoshi Ukai | 119dc91 | 2015-03-30 16:52:41 +0900 | [diff] [blame] | 64 | ruby runtest.rb |
| 65 | |
Shinichiro Hamaji | bbf6a71 | 2015-03-30 17:22:38 +0900 | [diff] [blame] | 66 | clean: |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 67 | rm -rf out kati ckati *.o *.d |
Shinichiro Hamaji | bbf6a71 | 2015-03-30 17:22:38 +0900 | [diff] [blame] | 68 | |
Fumitoshi Ukai | 119dc91 | 2015-03-30 16:52:41 +0900 | [diff] [blame] | 69 | .PHONY: test |
Shinichiro Hamaji | 5ca0ecd | 2015-04-30 18:30:56 +0900 | [diff] [blame] | 70 | |
| 71 | -include *.d |