-
Notifications
You must be signed in to change notification settings - Fork 7
/
host-rules.mk
56 lines (40 loc) · 1.76 KB
/
host-rules.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%.o: %.c
$(E) "[C] Compiling $<"
$(Q)$(HOST_CC) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -c -o $@ $<
%.o: %.cc
$(E) "[CXX] Compiling $<"
$(Q)$(HOST_CXX) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -c -o $@ $<
%.o: %.cpp
$(E) "[CXX] Compiling $<"
$(Q)$(HOST_CXX) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -c -o $@ $<
%.o: %.s
$(E) "[S] Compiling $<"
$(Q)$(HOST_AS) $(addprefix -I, $(HOST_INCLUDES)) $(HOST_ASFLAGS) $(HOST_CPPFLAGS) -g -c -o $@ $<
%.dep: %.c
$(Q)$(HOST_CC) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
%.dep: %.cc
$(Q)$(HOST_CXX) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
%.dep: %.cpp
$(Q)$(HOST_CXX) -Wall -Werror $(addprefix -I, $(HOST_INCLUDES)) $(HOST_CFLAGS) $(HOST_CPPFLAGS) -g -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
%.dep: %.s
$(Q)touch $@
%.dep: %.o
$(Q)touch $@
TARGET_OBJS += $(addsuffix .o, $(basename $(TARGET_SRCS)))
TARGET_DEPS += $(addsuffix .dep, $(basename $(TARGET_SRCS)))
ifneq ($(TARGET),)
TARGET_OBJS += $(addsuffix .o, $(basename $(TARGET)))
TARGET_DEPS += $(addsuffix .dep, $(basename $(TARGET)))
endif
$(TARGET): $(TARGET_OBJS) $(LIBDEPS)
$(E) "[L] Linking $@"
$(Q)$(HOST_LD) -o $@ $(TARGET_OBJS) $(HOST_LDFLAGS) -g $(LIBS)
$(TARGET_LIB): $(TARGET_OBJS)
$(E) "[LIB] Creating $@"
$(Q)$(HOST_AR) rcs $@ $^
.PHONY: clean-generic ldeps
clean-generic:
$(E) "[CLEAN] $(CURDIR)"
$(Q)rm -f $(TARGET_LIB) $(TARGET_OBJS) $(TARGET) $(TARGET_MAP) $(TARGET_DEPS)
ldeps: $(TARGET_DEPS)
-include $(TARGET_DEPS)