New developer version 0.6.8; added select () function; added demonstrating example...
[ZeXOS.git] / kernel / kernel.mak
blobe69387313a253b656d5767e71e7741e0efddeb6d
1 .SUFFIXES: .asm
3 # defines
4 MAKEFILE=Makefile
5 MAKEDEP=$(MAKEFILE)
6 LDSCRIPT=arch/main/link.ld
7 INCDIR =include/
8 NASM =nasm -f elf
9 CFLAGS =-g -O2 -nostdinc -fno-builtin -fno-stack-protector -I$(INCDIR) -Ibuild/main/
10 LDFLAGS =-g -T $(LDSCRIPT) -nostdlib
12 LIBC =lib/libc.a
13 LARCH =arch/arch.a
15 ifeq ($(ARCH),arm)
16 CFLAGS=-g -Os -fno-builtin -ffreestanding -nostdinc -pipe -mcpu=arm926ej-s -mabi=apcs-gnu -nostdlib -nostartfiles -nodefaultlibs -ffixed-r8 -msoft-float -Wno-unused-parameter -I$(INCDIR) -Ibuild/main/
17 endif
19 # object/source files
20 BOOT =arch/main/boot/start.o
21 CORE =core/main.o core/init.o core/console.o core/commands.o core/mm/kmem.o core/mm/kzmem.o core/mm/dlmem.o core/mm/swmem.o core/mm/pmem.o core/mm/usermem.o core/env.o core/elf.o core/dev.o core/vfs.o core/fs.o core/user.o core/sched.o core/proc.o core/tty.o core/partition.o core/module.o core/spinlock.o core/mutex.o core/smp.o core/ioctl.o core/fd.o core/errno.o core/cache.o core/its.o
22 NET =core/net/socket.o core/net/ips.o core/net/eth.o core/net/if.o core/net/arp.o core/net/packet.o core/net/tcp.o core/net/tcp6.o core/net/ip.o core/net/ipv6.o core/net/icmp.o core/net/icmp6.o core/net/ndp.o core/net/checksum.o core/net/udp.o core/net/udp6.o core/net/dns.o core/net/tun6.o core/net/unix.o core/net/hostname.o core/net/dhcp.o
23 SOUND =core/sound/audio.o
24 DRIVERS =drivers/char/video/video.o drivers/char/video/vesa.o drivers/char/video/gtext.o drivers/char/video/bga.o drivers/char/kbd/kbd.o drivers/char/rs232/rs232.o drivers/char/sound/speaker.o drivers/char/sound/sb16.o drivers/char/sound/es1370.o drivers/char/sound/ac97.o drivers/block/floppy.o drivers/block/drive.o drivers/fs/fat.o drivers/fs/fat16.o drivers/fs/zexfs.o drivers/fs/ext2.o drivers/fs/isofs.o drivers/fs/znfs.o drivers/bus/pci/pci.o drivers/bus/usb/usb.o drivers/net/pcnet32/pcnet32.o drivers/net/rtl8029/rtl8029.o drivers/net/rtl8139/rtl8139.o drivers/net/rtl8169/rtl8169.o drivers/char/mouse/com.o drivers/char/mouse/ps2.o
25 UTILS =utils/fs/ls.o utils/fs/cat.o utils/fs/cp.o utils/fs/rm.o utils/fs/cd.o utils/fs/mount.o utils/fs/mkdir.o utils/fs/fdisk.o utils/fs/touch.o utils/net/tftp.o utils/adm/adm.o
27 OBJS =$(BOOT) $(CORE) $(NET) $(SOUND) $(DRIVERS) $(UTILS)
29 ifneq ($(strip $(wildcard .config)),)
31 # targets
32 all: $(OBJS) kernel.bin
34 endif
36 install: kernel.bin
37 mount /dev/fd0 mnt
38 cp -f kernel.bin mnt/kernel.bin
39 umount mnt
40 qemu -fda /dev/fd0
42 clean:
43 $(Q)make clean -C lib
44 $(Q)make clean -C arch/main
45 $(Q)rm include/arch
46 $(Q)rm -f *.o kernel.bin .directory .kconfig.d .tmpconfig.h .config .config.old arch/main $(OBJS)
47 $(Q)rm -rf build/main/utils build/main/config.h build/main/build.h build/main build/utils
48 @printf " CLEAN\n";
50 # implicit rules
51 .S.o:
52 @printf " ASM $(subst $(shell pwd)/,,$(@))\n";
53 $(Q)$(CC) -c -o$@ $<
55 .s.o:
56 @printf " ASM $(subst $(shell pwd)/,,$(@))\n";
57 $(Q)$(NASM) -o$@ $<
59 .c.o:
60 @printf " CC $(subst $(shell pwd)/,,$(@))\n";
61 $(Q)$(CC) $(CFLAGS) -c -o$@ $<
63 # explicit rules
64 kernel.bin: $(OBJS) $(LARCH) $(LDSCRIPT) $(LIBC) $(MAKEDEP)
65 @printf " LD $(subst $(shell pwd)/,,$(@))\n";
66 $(Q)$(LD) $(LDFLAGS) -o$@ $(OBJS) $(LARCH) $(LIBC)