This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (45 loc) · 1.5 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
SRC=src
OUT=out
KERNEL=demos.exe
KERNEL_DIRTY=$(KERNEL).dirty
CC=gcc
CC_INCLUDES=-I$(SRC)
CC_FLAGS=-c -ansi -m32 -g -Wall $(CC_INCLUDES)
GAS_FLAGS=-c -m32 -g -Wall $(CC_INCLUDES)
LD=/usr/bin/ld
LD_FLAGS=-T link.ld -m i386pe
PYTHON=C:/Python34/python.exe
OBJECTS=header.o main.o string.o raw_video.o cpu.o gdt.o com.o bda.o vga.o \
interrupts_isr.o interrupts.o pic.o ps2.o keyboard.o conio.o cmd.o
FILES=$(OUT)/$(KERNEL) $(OUT)/$(KERNEL_DIRTY) \
$(foreach o,$(OBJECTS),$(OUT)/$(o)) \
configuration.ld $(SRC)/configuration.h
CONFIG=./config.py
BOOT_DIR=/media/demos/boot
ACQUIRE_COMMAND='mount /media/demos'
RELEASE_COMMAND='umount /media/demos || true'
SSH=ssh $(INSTALL_HOST)
SCP=scp
$(OUT):
mkdir -p $@
configuration.%:
$(PYTHON) $(CONFIG) conf $@
%.o: $(SRC)/%.c $(SRC)/configuration.h $(OUT)
$(CC) $(CC_FLAGS) -o $(OUT)/$@ $<
%.o: $(SRC)/%.S $(SRC)/configuration.h $(OUT)
$(CC) $(GAS_FLAGS) -o $(OUT)/$@ $<
$(KERNEL_DIRTY): $(OBJECTS) $(SRC)/configuration.h configuration.ld $(OUT)
$(LD) $(LD_FLAGS) -o $(OUT)/$@ $(foreach o,$(OBJECTS),$(OUT)/$(o))
$(KERNEL): $(KERNEL_DIRTY)
objcopy -g -O elf32-i386 $(OUT)/$< $(OUT)/$@
all: $(KERNEL)
install: all
$(SSH) $(ACQUIRE_COMMAND)
$(SCP) $(OUT)/$(KERNEL) $(INSTALL_HOST):$(BOOT_DIR)/$(KERNEL)
$(SCP) grub.cfg $(INSTALL_HOST):$(BOOT_DIR)/grub/grub.cfg
$(SSH) $(RELEASE_COMMAND)
release_remote:
$(SSH) $(RELEASE_COMMAND)
clean: release_remote
rm -f $(FILES)