comparison uprogs/Makefile @ 0:c450faca55f4

Init
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sun, 22 Oct 2017 18:25:39 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c450faca55f4
1 # Cross-compiling (e.g., on Mac OS X)
2 #TOOLPREFIX = i386-jos-elf-
3 # Using native tools (e.g., on X86 Linux)
4 TOOLPREFIX =
5
6
7 # The intermediate directory for compiled object files.
8 BUILD = build/
9
10 CC = $(TOOLPREFIX)gcc
11 AS = $(TOOLPREFIX)as
12 LD = $(TOOLPREFIX)ld
13 OBJCOPY = $(TOOLPREFIX)objcopy
14 OBJDUMP = $(TOOLPREFIX)objdump
15 CFLAGS := -fno-pic -static -fno-builtin -fno-strict-aliasing -fshort-wchar -O2 -Wall -MD -ggdb -Werror -fno-omit-frame-pointer -fno-stack-protector -Wa,-march=armv6 -Wa,-mcpu=arm1176jzf-s
16
17 initcode: initcode.S
18 $(CC) $(CFLAGS) -nostdinc -I. -c initcode.S
19 $(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o
20 $(OBJCOPY) -S -O binary initcode.out initcode
21 $(OBJDUMP) -S initcode.o > initcode.asm
22
23
24 ULIB = ulib.o usys.o printf.o umalloc.o
25
26 _%: %.o $(ULIB)
27 $(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^
28 $(OBJDUMP) -S $@ > $*.asm
29 $(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
30
31 _forktest: forktest.o $(ULIB)
32 # forktest has less library code linked in - needs to be small
33 # in order to be able to max out the proc table.
34 $(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
35 $(OBJDUMP) -S _forktest > forktest.asm
36
37 mkfs: mkfs.c ../include/fs.h
38 gcc -Werror -Wall -o mkfs mkfs.c
39
40 # Prevent deletion of intermediate files, e.g. cat.o, after first build, so
41 # that disk image changes after first build are persistent until clean. More
42 # details:
43 # http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
44 .PRECIOUS: %.o
45
46 UPROGS=\
47 _cat\
48 _echo\
49 _forktest\
50 _grep\
51 _init\
52 _kill\
53 _ln\
54 _ls\
55 _mkdir\
56 _rm\
57 _sh\
58 _stressfs\
59 _usertests\
60 _wc\
61 _zombie\
62
63 fs.img: mkfs README $(UPROGS)
64 ./mkfs fs.img README $(UPROGS)
65
66 clean:
67 rm -f *.o *.d fs.img mkfs $(UPROGS)