-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
69 lines (49 loc) · 1.82 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
# set this to point to your eCos "install" directory:
export PATH += :/opt/ecos/gnutools/i386-elf/bin
PWD = $(shell pwd)
ECOS = $(realpath build-ecos/install)
$(info using ECOS installation at "$(ECOS)")
# get commands and options used to build stuff
-include $(ECOS)/include/pkgconf/ecos.mak
export XAR = $(ECOS_COMMAND_PREFIX)ar
export XRANLIB = $(ECOS_COMMAND_PREFIX)ranlib
export XSTRIP = $(ECOS_COMMAND_PREFIX)strip
export XCC = $(ECOS_COMMAND_PREFIX)gcc
export XLD = $(ECOS_COMMAND_PREFIX)ld
export DEFINES = -D__ECOS
export INCLUDES = -I$(ECOS)/include
export CXXFLAGS = $(filter-out -fvtable-gc, $(ECOS_GLOBAL_CFLAGS)) -Werror
export CXXFLAGS = $(filter-out -fvtable-gc, $(ECOS_GLOBAL_CFLAGS)) -Werror
export CFLAGS = $(filter-out -fno-rtti, $(CXXFLAGS)) -Wall
export LDFLAGS = $(ECOS_GLOBAL_LDFLAGS)
export LIBS = -L$(ECOS)/lib -Ttarget.ld -nostdlib
export XCXX = $(XCC)
INCLUDES += -I$(PWD)
%.hex: %
$(XOBJCOPY) -O ihex $< $@
%.srec: %.hex
$(XOBJCOPY) -I ihex -O srec $< $@
%.bin: %
$(XOBJCOPY) -O binary $< $@
%.o: %.c
$(XCC) -c -o $@ $(CFLAGS) $(DEFINES) $(INCLUDES) $<
%.o: %.cxx
$(XCXX) -c -o $@ $(CXXFLAGS) $(DEFINES) $(INCLUDES) $<
%.o: %.S
$(XCC) -c -o $@ $(CFLAGS) $(DEFINES) $(INCLUDES) $<
%.o: %.s
$(XCC) $(CFLAGS)) -o $@ $<
all: hello.elf server.elf
server.elf: server.o $(ECOS)/lib/target.ld $(ECOS)/lib/libtarget.a
$(XCC) -Wl,-Map,[email protected] $(LDFLAGS) -o $@ server.o $(LIBS)
hello.elf: hello.o $(ECOS)/lib/target.ld $(ECOS)/lib/libtarget.a
$(XCC) -Wl,-Map,[email protected] $(LDFLAGS) -o $@ hello.o $(LIBS)
qemu-%: %.elf
$(MAKE) && ./runit.sh $<
clean:
rm -f *.o *.elf *.map *~
cleanall:
make clean
rm -rf build-redboot build-ecos
index.html: Readme.txt
asciidoc -a data-uri -a toc -a max-width=42em -o index.html Readme.txt