-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (55 loc) · 1.46 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
CROSS_COMPILE ?= arm-linux-gnueabihf-
CC ?= $(CROSS_COMPILE)gcc
CFLAGS += -DAVB_COMPILATION -O2
DBGFLAGS := -g -DDEBUG=1 -O0
CCOBJFLAGS := $(CFLAGS) -c
BIN_PATH ?= bin
OBJ_PATH ?= obj
SRC_PATH := .
DBG_PATH ?= debug
TARGET_NAME := aml-avb-dm-verity
TARGET := $(BIN_PATH)/$(TARGET_NAME)
TARGET_DEBUG := $(DBG_PATH)/$(TARGET_NAME)
# src files & obj files
SRC := avb_dm_verity.o \
avb_util.o \
avb_sysdeps_posix.o \
avb_footer.o \
avb_descriptor.o \
avb_chain_partition_descriptor.o \
avb_hashtree_descriptor.o
OBJ := $(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC)))))
OBJ_DEBUG := $(addprefix $(DBG_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC)))))
# clean files list
DISTCLEAN_LIST := $(OBJ) \
$(OBJ_DEBUG)
CLEAN_LIST := $(TARGET) \
$(TARGET_DEBUG) \
$(DISTCLEAN_LIST)
# default rule
default: makedir all
# non-phony targets
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) -o $@ $(OBJ)
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c*
$(CC) $(CCOBJFLAGS) -o $@ $<
$(DBG_PATH)/%.o: $(SRC_PATH)/%.c*
$(CC) $(CCOBJFLAGS) $(DBGFLAGS) -o $@ $<
$(TARGET_DEBUG): $(OBJ_DEBUG)
$(CC) $(CFLAGS) $(DBGFLAGS) $(OBJ_DEBUG) -o $@
# phony rules
.PHONY: makedir
makedir:
@mkdir -p $(BIN_PATH) $(OBJ_PATH) $(DBG_PATH)
.PHONY: all
all: $(TARGET) $(TARGET_DEBUG)
.PHONY: debug
debug: $(TARGET_DEBUG)
.PHONY: clean
clean:
@echo CLEAN $(CLEAN_LIST)
@rm -f $(CLEAN_LIST)
.PHONY: distclean
distclean:
@echo CLEAN $(CLEAN_LIST)
@rm -f $(DISTCLEAN_LIST)