-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·46 lines (31 loc) · 952 Bytes
/
Makefile
File metadata and controls
executable file
·46 lines (31 loc) · 952 Bytes
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
CFLAGS = -mcpu=arm926ej-s -nostartfiles -fno-common -g
CROSS ?= arm-none-linux-gnueabi-
objdir ?= .obj
csources = $(wildcard *.c)
asmsources = $(wildcard *.S)
asmobjs := $(patsubst %.S,$(objdir)/%.o,$(notdir $(asmsources)))
cobjs := $(patsubst %.c,$(objdir)/%.o,$(notdir $(csources)))
objs := $(cobjs) $(asmobjs)
dummy = $(objdir)/.dummy
tgt := final
$(tgt): $(dummy) $(objs)
$(CROSS)gcc $(objs) -o $@ -Wl,-T ld.script -Wl,-M -nostdlib $(CFLAGS) > final.map
$(CROSS)objcopy -O binary $@ $@.bin
$(objdir)/%.o:%.c
$(CROSS)gcc -c $^ $(CFLAGS) -o $@
$(objdir)/%.o:%.S
$(CROSS)gcc -c $^ $(CFLAGS) -o $@
print:
echo $(objs)
$(objdir)/.dummy :
if [ ! -d $(objdir) ] ; then \
mkdir -p $(objdir); \
fi
touch $(objdir)/.dummy
cscope:
find $(shell pwd) -name "*.[chs]" > $(objdir)/cscope.files
cd $(objdir) && cscope -b -k -q
clean:
rm -rf $(objdir) final final.bin final.map
run:
qemu-system-arm -M versatilepb