-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile
78 lines (53 loc) · 1.52 KB
/
Makefile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# blessed Makefile
-include Makefile.config
ifeq ($(PLATFORM),)
$(error PLATFORM is not defined)
endif
PLATFORM_PATH = platform/$(PLATFORM)
-include $(PLATFORM_PATH)/Makefile.platform
CONFIGS = $(addprefix -D, $(-*-command-variables-*-))
BUILD_PATH = build
LIB_TARGET = $(BUILD_PATH)/libblessed.a
INCLUDE_PATHS = $(PLATFORM_INCLUDE_PATHS) \
include \
stack
INCLUDES = $(addprefix -I, $(INCLUDE_PATHS))
CFLAGS = -O2 -Wall $(PLATFORM_CFLAGS) \
$(INCLUDES) \
$(CONFIGS)
ASMFLAGS = -O2 -Wall $(PLATFORM_ASMFLAGS)
LDFLAGS = $(PLATFORM_LDFLAGS)
SOURCE_PATHS = $(PLATFORM_SOURCE_PATHS) \
stack
SOURCE_FILES = $(PLATFORM_SOURCE_FILES) \
ll.c \
bci.c
ASM_PATHS = $(PLATFORM_ASM_PATHS)
ASM_FILES = $(PLATFORM_ASM_FILES)
C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(SOURCE_FILES:.c=.o))
ASM_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(ASM_FILES:.s=.o))
vpath %.c $(SOURCE_PATHS)
vpath %.s $(ASM_PATHS)
all: $(BUILD_PATH) $(LIB_TARGET)
$(LIB_TARGET): $(C_OBJ_FILES) $(ASM_OBJ_FILES)
@echo -e "AR\t $@"
@$(AR) $(ARFLAGS) $@ $(C_OBJ_FILES) $(ASM_OBJ_FILES) > /dev/null 2>&1
@echo -e "SIZE\t $@"
@$(SIZE) $@
$(BUILD_PATH)/%.o: %.c
@echo -e "CC\t $<"
@$(CC) $(CFLAGS) -o $@ $<
$(BUILD_PATH)/%.o: %.s
@echo -e "CC\t $<"
@$(CC) $(ASMFLAGS) -o $@ $<
$(BUILD_PATH):
@echo -e "MKDIR\t $@"
@-mkdir $@
clean:
@echo -e "CLEAN"
@rm -rf $(BUILD_PATH) *.log
maintainer-clean: clean
$(MAKE) -C examples clean
examples: all
$(MAKE) -C examples
.PHONY: all clean examples