Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [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 | |
| 15 | CXX_SRCS:= \ |
| 16 | ast.cc \ |
| 17 | command.cc \ |
| 18 | dep.cc \ |
| 19 | eval.cc \ |
| 20 | exec.cc \ |
| 21 | file.cc \ |
| 22 | file_cache.cc \ |
| 23 | fileutil.cc \ |
| 24 | find.cc \ |
| 25 | flags.cc \ |
| 26 | func.cc \ |
| 27 | log.cc \ |
| 28 | main.cc \ |
| 29 | ninja.cc \ |
| 30 | parser.cc \ |
| 31 | rule.cc \ |
| 32 | stats.cc \ |
| 33 | string_piece.cc \ |
| 34 | stringprintf.cc \ |
| 35 | strutil.cc \ |
| 36 | symtab.cc \ |
| 37 | timeutil.cc \ |
| 38 | value.cc \ |
| 39 | var.cc \ |
| 40 | version.cc |
| 41 | CXX_TEST_SRCS:= \ |
| 42 | $(wildcard *_test.cc) |
| 43 | CXX_OBJS:=$(CXX_SRCS:.cc=.o) |
| 44 | CXX_TEST_OBJS:=$(CXX_TEST_SRCS:.cc=.o) |
| 45 | CXX_ALL_OBJS:=$(CXX_SRCS:.cc=.o) $(CXX_TEST_SRCS:.cc=.o) |
| 46 | CXX_TEST_EXES:=$(CXX_TEST_OBJS:.o=) |
| 47 | CXXFLAGS:=-g -W -Wall -MMD |
| 48 | CXXFLAGS+=-O -DNOLOG |
| 49 | #CXXFLAGS+=-pg |
| 50 | |
| 51 | ckati: $(CXX_OBJS) |
| 52 | $(CXX) -std=c++11 $(CXXFLAGS) -o $@ $(CXX_OBJS) |
| 53 | |
| 54 | $(CXX_ALL_OBJS): %.o: %.cc |
| 55 | $(CXX) -c -std=c++11 $(CXXFLAGS) -o $@ $< |
| 56 | |
| 57 | ckati_tests: $(CXX_TEST_EXES) |
| 58 | |
| 59 | $(CXX_TEST_EXES): $(filter-out main.o,$(CXX_OBJS)) |
| 60 | $(CXX_TEST_EXES): %: %.o |
| 61 | $(CXX) $^ -o $@ |
| 62 | |
| 63 | version.cc: .git/HEAD .git/index |
| 64 | echo '// +build ignore' > $@ |
| 65 | echo >> $@ |
| 66 | echo 'const char* kGitVersion = "$(shell git rev-parse HEAD)";' >> $@ |
| 67 | |
| 68 | ckati_clean: |
| 69 | rm -rf ckati *.o *.d $(CXX_TEST_EXES) version.cc |
| 70 | |
| 71 | .PHONY: ckati_clean |
| 72 | |
| 73 | -include *.d |