forked from mikaku/Fiwix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (62 loc) · 1.7 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
# fiwix/Makefile
#
# Copyright 2018-2022, Jordi Sanfeliu. All rights reserved.
# Distributed under the terms of the Fiwix License.
#
TOPDIR := $(shell if [ "$$PWD" != "" ] ; then echo $$PWD ; else pwd ; fi)
INCLUDE = $(TOPDIR)/include
ARCH = -m32
CPU = -march=i386
CC = $(CROSS_COMPILE)gcc $(ARCH) $(CPU) -D__KERNEL__ #-D__DEBUG__
LD = $(CROSS_COMPILE)ld
CFLAGS = -I$(INCLUDE) -O2 -ffreestanding -Wall -Wstrict-prototypes #-Wextra
LDFLAGS = -m elf_i386 -nostartfiles -nostdlib -nodefaultlibs -nostdinc
DIRS = kernel \
kernel/syscalls \
mm \
fs \
drivers/char \
drivers/block \
drivers/pci \
drivers/video \
lib
OBJS = kernel/*.o \
kernel/syscalls/*.o \
mm/*.o \
fs/*.o \
fs/ext2/*.o \
fs/iso9660/*.o \
fs/minix/*.o \
fs/pipefs/*.o \
fs/procfs/*.o \
drivers/char/*.o \
drivers/block/*.o \
drivers/pci/*.o \
drivers/video/*.o \
lib/*.o
export CC LD CFLAGS LDFLAGS INCLUDE
all:
@echo "#define UTS_VERSION \"`date`\"" > include/fiwix/version.h
@for n in $(DIRS) ; do (cd $$n ; $(MAKE)) ; done
$(LD) -N -T fiwix.ld $(LDFLAGS) $(OBJS) -o fiwix
nm fiwix | sort | gzip -9c > System.map.gz
clean:
@for n in $(DIRS) ; do (cd $$n ; $(MAKE) clean) ; done
rm -f *.o fiwix System.map.gz
floppy:
mkfs.ext2 -m 0 /dev/fd0
mount -t ext2 /dev/fd0 /mnt/floppy
@mkdir -p /mnt/floppy/boot/grub
@echo "(fd0) /dev/fd0" > /mnt/floppy/boot/grub/device.map
@grub-install --root-directory=/mnt/floppy /dev/fd0
@tools/MAKEBOOTDISK
@cp -prf tools/etc/* /mnt/floppy/etc
@cp fiwix /mnt/floppy/boot
@cp System.map.gz /mnt/floppy/boot
@cp tools/install.sh /mnt/floppy/sbin
umount /mnt/floppy
floppy_update:
mount -t ext2 /dev/fd0 /mnt/floppy
cp fiwix /mnt/floppy/boot
cp System.map.gz /mnt/floppy/boot
umount /mnt/floppy