-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (40 loc) · 840 Bytes
/
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
#
CROSS_COMPILE ?=
NAME = tinydtb
#
SRC = $(wildcard src/*.c)
INC = $(wildcard src/*.h)
OBJ = $(patsubst src/%.c,build/%.o,$(SRC))
CFLAGS += -nostdlib -ffreestanding
CFLAGS += -Os -fno-common
CFLAGS += -I src
#
all: build/lib$(NAME).a examples
ls -l build/lib$(NAME).a
examples: build/lib$(NAME).a
ifeq (,$(CROSS_COMPILE))
make -C examples
endif
run: examples
make -C examples run
.PHONY: fuzz
fuzz:
cd fuzz && ./lxc.sh
.PHONY: test
test:
@echo "TODO :("
build/lib$(NAME).a: $(OBJ) Makefile
@echo AR $@
@$(CROSS_COMPILE)ar rcs $@ $(OBJ)
@$(CROSS_COMPILE)objdump -dth $@ > $@.dis
build/%.o: src/%.c Makefile build $(INC)
@echo GCC $<
@$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@
@$(CROSS_COMPILE)objdump -d $@ > $@.dis
@$(CROSS_COMPILE)objdump -h $@
#
build:
mkdir build
clean:
rm -rf build
make -C examples clean