|
| 1 | +##===- Makefile --------------------------------------------*- Makefile -*-===## |
| 2 | +# |
| 3 | +# This source file is part of the Swift.org open source project |
| 4 | +# |
| 5 | +# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors |
| 6 | +# Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +# |
| 8 | +# See http://swift.org/LICENSE.txt for license information |
| 9 | +# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +# |
| 11 | +##===----------------------------------------------------------------------===## |
| 12 | + |
| 13 | +# If SWIFT_LEVEL is not set, then we are the top-level Makefile. Otherwise, we |
| 14 | +# are being included from a subdirectory makefile. |
| 15 | + |
| 16 | +ifndef SWIFT_LEVEL |
| 17 | + |
| 18 | +IS_TOP_LEVEL := 1 |
| 19 | +SWIFT_LEVEL := . |
| 20 | +DIRS := lib tools # include docs |
| 21 | + |
| 22 | +PARALLEL_DIRS := |
| 23 | + |
| 24 | +endif |
| 25 | + |
| 26 | +ifeq ($(MAKECMDGOALS),libs-only) |
| 27 | + DIRS := $(filter-out tools docs, $(DIRS)) |
| 28 | + OPTIONAL_DIRS := |
| 29 | +endif |
| 30 | + |
| 31 | +### |
| 32 | +# Common Makefile code, shared by all Swift Makefiles. |
| 33 | + |
| 34 | +# Set LLVM source root level. |
| 35 | +LEVEL := $(SWIFT_LEVEL)/../.. |
| 36 | + |
| 37 | +# Include LLVM common makefile. |
| 38 | +include $(LEVEL)/Makefile.common |
| 39 | + |
| 40 | +# Set common Swift build flags. |
| 41 | +CPP.Flags += -I$(PROJ_SRC_DIR)/$(SWIFT_LEVEL)/include \ |
| 42 | + -I$(PROJ_OBJ_DIR)/$(SWIFT_LEVEL)/include |
| 43 | +ifdef SWIFT_VENDOR |
| 44 | +CPP.Flags += -DSWIFT_VENDOR='"$(SWIFT_VENDOR) "' |
| 45 | +endif |
| 46 | + |
| 47 | +### |
| 48 | +# Swift Top Level specific stuff. |
| 49 | + |
| 50 | +ifeq ($(IS_TOP_LEVEL),1) |
| 51 | + |
| 52 | +ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) |
| 53 | +$(RecursiveTargets):: |
| 54 | + $(Verb) if [ ! -f test/Makefile ]; then \ |
| 55 | + $(MKDIR) test; \ |
| 56 | + $(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \ |
| 57 | + fi |
| 58 | +endif |
| 59 | + |
| 60 | +test:: |
| 61 | + @ $(MAKE) -C test |
| 62 | + |
| 63 | +report:: |
| 64 | + @ $(MAKE) -C test report |
| 65 | + |
| 66 | +clean:: |
| 67 | + @ $(MAKE) -C test clean |
| 68 | + |
| 69 | +libs-only: all |
| 70 | + |
| 71 | +tags:: |
| 72 | + $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \ |
| 73 | + grep -v /lib/Headers | grep -v /test/` |
| 74 | + |
| 75 | +cscope.files: |
| 76 | + find tools lib include -name '*.cpp' \ |
| 77 | + -or -name '*.def' \ |
| 78 | + -or -name '*.td' \ |
| 79 | + -or -name '*.h' > cscope.files |
| 80 | + |
| 81 | +.PHONY: test report clean cscope.files |
| 82 | + |
| 83 | +endif |
0 commit comments