-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (32 loc) · 765 Bytes
/
Makefile
File metadata and controls
40 lines (32 loc) · 765 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
#
# link demo Makefile
#
# (C) 2017.09 <buddy.zhang@aliyun.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
CC=gcc
LD=ld
AS=as
OBJDP=objdump
CFLAGS := -m32
LDFLAGS := -m elf_i386
ASFLAGS := --32
objs += main.o
# objdump
debug_dump = \
$(OBJDP) -s -S -x -dh $(1) > $(1).objdump
#debug rule
cross_all = \
$(CC) $(CFLAGS) -E -o $(1).i $(1).c; \
$(CC) $(CFLAGS) -S -o $(1).s $(1).i; \
$(AS) $(ASFLAGS) -o $(1).o $(1).s; \
link: $(objs)
$(CC) $(CFLAGS) $^ -o $@
$(call debug_dump,$@)
$(objs):
$(call cross_all,$(patsubst %.o,%,$@))
PHONY += clean
clean:
rm -rf *.i *.o link *.s *.objdump