aboutsummaryrefslogblamecommitdiff
path: root/cpuid/Makefile
blob: 069e75585b75f37c52b9190d2f4c080f0a1e5c0b (plain) (tree)












































                                                                                                                    
# Makefile for CPUID

CC = /usr/bin/gcc
LD = /usr/bin/ld
PERL = /usr/bin/perl

LDCONF = ld.conf

CFLAGS = -Wall -Os -m32 -fno-reorder-functions -nostartfiles -nostdlib -fno-builtin -I. -I.
LDFLAGS = -T $(LDCONF) -melf_i386 -s

BOOTSECTORSRC = boot.S
BOOTSECTOR = $(BOOTSECTORSRC:.S=.o)

CFILES = entry.c interrupt.c memory.c video.c keyboard.c serial.c log.c string.c stdio.c malloc.c spinlock.c timer.c
HFILES = cpuid.h string.h stdlib.h stdio.h spinlock.h
SFILES = head.S igate.S
OFILES = $(SFILES:.S=.o) $(CFILES:.c=.o)
ASMFILES = $(CFILES:.c=.S)

MAPFILE = boot.map
SETSECTORS = $(PERL) setsectors.pl $(MAPFILE)

.PHONY : all asm clean

all : floppy.img

floppy.img : boot
	dd if=/dev/zero of=$@ bs=512 count=2880
	dd if=boot of=$@ bs=512 conv=notrunc

boot : $(BOOTSECTOR) $(OFILES) $(HFILES)
	$(LD) $(LDFLAGS) $(BOOTSECTOR) $(OFILES) -o $@ -M >$(MAPFILE)
	$(SETSECTORS)

asm : $(ASMFILES)

%.o : %.S
	$(CC) -DASM $(CFLAGS) -c $< -o $@

%.S : %.c
	$(CC) $(CFLAGS) -S $< -o $@

clean :
	rm -f $(OFILES) $(ASMFILES) $(BOOTSECTOR) boot.map *~ boot floppy.img