InputEvents: make "Pan" a virtual mode
[xcsoar.git] / build / compile.mk
blob3edea824404637e2a1688952da76df5041df44f5
1 ######## tools
3 CCACHE :=
4 ifeq ($(USE_CCACHE),y)
5 CCACHE := ccache$(EXE)
6 endif
8 EXE := $(findstring .exe,$(MAKE))
9 AR = $(TCPREFIX)ar$(EXE)
10 AS = $(TCPREFIX)as$(EXE)
11 ifneq ($(ANALYZER),y)
12 ifeq ($(CLANG),y)
13 CXX = $(TCPREFIX)clang++$(TCSUFFIX)$(EXE)
14 CC = $(TCPREFIX)clang$(TCSUFFIX)$(EXE)
15 else
16 CXX = $(TCPREFIX)g++$(TCSUFFIX)$(EXE)
17 CC = $(TCPREFIX)gcc$(TCSUFFIX)$(EXE)
18 endif
19 endif
20 DLLTOOL = $(TCPREFIX)dlltool$(EXE)
21 SIZE = $(TCPREFIX)size$(EXE)
22 STRIP = $(TCPREFIX)strip$(EXE)
23 WINDRES = $(TCPREFIX)windres$(EXE)
24 ARFLAGS = rcs
26 ifeq ($(TARGET),WINE)
27 AR = ar$(EXE)
28 STRIP = strip$(EXE)
29 WINDRES = wrc$(EXE)
30 endif
32 ifeq ($(TARGET)$(CLANG),ANDROIDy)
33 # on NDK r8c, binutils are only in the gcc toolchain directory
34 AR = $(ANDROID_GCC_TOOLCHAIN)/bin/$(ANDROID_ABI4)-ar$(EXE)
35 STRIP = $(ANDROID_GCC_TOOLCHAIN)/bin/$(ANDROID_ABI4)-strip$(EXE)
36 endif
38 ####### paths
40 ifeq ($(LLVM),y)
41 # generate LLVM bitcode
42 OBJ_SUFFIX = .bc
43 else
44 OBJ_SUFFIX = .o
45 endif
47 # Converts a list of source file names to *.o
48 SRC_TO_OBJ = $(patsubst %.cpp,%$(OBJ_SUFFIX),$(patsubst %.c,%$(OBJ_SUFFIX),$(addprefix $(TARGET_OUTPUT_DIR)/,$(1))))
50 ####### dependency handling
52 DEPFILE = $(@:$(OBJ_SUFFIX)=.d)
53 DEPFLAGS = -Wp,-MD,$(DEPFILE),-MT,$@
54 cc-flags = $(DEPFLAGS) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(TARGET_ARCH) $(FLAGS_COVERAGE)
55 cxx-flags = $(DEPFLAGS) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(TARGET_ARCH) $(FLAGS_COVERAGE)
58 # Useful debugging targets - make preprocessed versions of the source
60 $(TARGET_OUTPUT_DIR)/%.i: %.cpp FORCE
61 $(CXX) $(cxx-flags) -E $(OUTPUT_OPTION) $<
63 $(TARGET_OUTPUT_DIR)/%.s: %.cpp FORCE
64 $(CXX) $(cxx-flags) -S $(OUTPUT_OPTION) $<
66 $(TARGET_OUTPUT_DIR)/%.i: %.c FORCE
67 $(CC) $(cc-flags) -E $(OUTPUT_OPTION) $<
69 ####### build rules
72 # Provide our own rules for building...
75 WRAPPED_CC = $(CCACHE) $(CC)
76 WRAPPED_CXX = $(CCACHE) $(CXX)
78 $(TARGET_OUTPUT_DIR)/%$(OBJ_SUFFIX): %.c $(TARGET_OUTPUT_DIR)/%/../dirstamp
79 @$(NQ)echo " CC $@"
80 $(Q)$(WRAPPED_CC) -c -o $@ $(cc-flags) $<
82 $(TARGET_OUTPUT_DIR)/%$(OBJ_SUFFIX): %.cpp $(TARGET_OUTPUT_DIR)/%/../dirstamp
83 @$(NQ)echo " CXX $@"
84 $(Q)$(WRAPPED_CXX) -c -o $@ $(cxx-flags) $<