-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
141 lines (96 loc) · 2.96 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
################################
##############ZeOS #############
################################
########## Makefile ############
################################
# package dev86 is required
AS86 = as86 -0 -a
LD86 = ld86 -0
HOSTCFLAGS = -Wall -Wstrict-prototypes -g
HOSTCC = gcc
CC = gcc
AS = as --32
LD = ld
OBJCOPY = objcopy -O binary -R .note -R .comment -S
INCLUDEDIR = include
CFLAGS = -m32 -O2 -g -fno-omit-frame-pointer -ffreestanding -Wall -I$(INCLUDEDIR) -fno-PIC
ASMFLAGS = -I$(INCLUDEDIR)
LDFLAGS = -g -melf_i386
SYSOBJ = \
interrupt.o \
entry.o \
sys_call_table.o \
io.o \
sched.o \
sys.o \
mm.o \
devices.o \
utils.o \
hardware.o \
list.o \
sys_libc.o \
tasks.o \
circ_buff.o \
LIBZEOS = -L . -l zeos
#add to USROBJ any object files required to complete the user program
USROBJ = \
libc.o \
suma.o \
wrappers.o \
espera.o \
game.o \
list.o \
# libjp.a \
all:zeos.bin
zeos.bin: bootsect system build user
$(OBJCOPY) system system.out
$(OBJCOPY) user user.out
./build bootsect system.out user.out > zeos.bin
build: build.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
bootsect: bootsect.o
$(LD86) -s -o $@ $<
bootsect.o: bootsect.s
$(AS86) -o $@ $<
bootsect.s: bootsect.S
$(CPP) $(ASMFLAGS) -traditional $< -o $@
entry.s: entry.S $(INCLUDEDIR)/asm.h $(INCLUDEDIR)/segment.h
$(CPP) $(ASMFLAGS) -o $@ $<
# Cosas añadidas por mí para no perderlas de lugar xd
suma.s: suma.S $(INCLUDEDIR)/asm.h
$(CPP) $(ASMFLAGS) -o $@ $<
wrappers.s: wrappers.S $(INCLUDEDIR)/asm.h
$(CPP) $(ASMFLAGS) -o $@ $<
tasks.s: tasks.S $(INCLUDEDIR)/asm.h
$(CPP) $(ASMFLAGS) -o $@ $<
espera.s: espera.S $(INCLUDEDIR)/asm.h
$(CPP) $(ASMFLAGS) -o $@ $<
circ_buff.o: circ_buff.c $(INCLUDEDIR)/circ_buff.h
game.o: game.c $(INCLUDEDIR)/game.h
sys_libc.o:sys_libc.c $(INCLUDEDIR)/sys_libc.h
sys_call_table.s: sys_call_table.S $(INCLUDEDIR)/asm.h $(INCLUDEDIR)/segment.h
$(CPP) $(ASMFLAGS) -o $@ $<
user.o:user.c $(INCLUDEDIR)/libc.h
interrupt.o:interrupt.c $(INCLUDEDIR)/interrupt.h $(INCLUDEDIR)/segment.h $(INCLUDEDIR)/types.h
io.o:io.c $(INCLUDEDIR)/io.h
sched.o:sched.c $(INCLUDEDIR)/sched.h
libc.o:libc.c $(INCLUDEDIR)/libc.h
mm.o:mm.c $(INCLUDEDIR)/types.h $(INCLUDEDIR)/mm.h
sys.o:sys.c $(INCLUDEDIR)/devices.h
utils.o:utils.c $(INCLUDEDIR)/utils.h
system.o:system.c $(INCLUDEDIR)/hardware.h system.lds $(SYSOBJ) $(INCLUDEDIR)/segment.h $(INCLUDEDIR)/types.h $(INCLUDEDIR)/interrupt.h $(INCLUDEDIR)/system.h $(INCLUDEDIR)/sched.h $(INCLUDEDIR)/mm.h $(INCLUDEDIR)/io.h $(INCLUDEDIR)/mm_address.h
system: system.o system.lds $(SYSOBJ)
$(LD) $(LDFLAGS) -T system.lds -o $@ $< $(SYSOBJ) $(LIBZEOS)
user: user.o user.lds $(USROBJ)
$(LD) $(LDFLAGS) -T user.lds -o $@ $< $(USROBJ)
clean:
rm -f *.o *.s bochsout.txt parport.out system.out system bootsect zeos.bin user user.out *~ build
disk: zeos.bin
dd if=zeos.bin of=/dev/fd0
emul: zeos.bin
bochs -q -f .bochsrc
gdb: zeos.bin
bochs -q -f .bochsrc_gdb &
gdb -x .gdbcmd system
emuldbg: zeos.bin
bochs_nogdb -q -f .bochsrc