-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
133 lines (103 loc) · 3.57 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
# This makefile was generated by autochaos 0.2.0. Please do not
# tamper with it unless you are very certain about what you are doing.
ALL_ARGUMENTS =
PREFIX = /mnt/chaos
PACKAGE = stormG2
# Compiler flags.
CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
-Werror -Wcast-align -Wsign-compare \
-Wmissing-declarations -Wmissing-noreturns -pipe \
-Wnested-externs -O3 -fno-builtin -funsigned-char -g -fomit-frame-pointer -ffreestanding $(EXTRA_CFLAGS) $(DEFINES)
INCLUDES = \
-I../include \
-I.. \
-I. -I$(PREFIX)/data/programming/c/headers
SUB_DIRECTORIES = \
include \
generic \
ia32
ALL_OBJECTS = \
generic/id.o \
generic/list.o \
generic/memory_global.o \
generic/multiboot.o \
generic/slab.o \
ia32/init.o \
ia32/debug.o \
ia32/dispatch.o \
ia32/exception.o \
ia32/gdt.o \
ia32/idt.o \
ia32/main.o \
ia32/memory_virtual.o \
ia32/memory_physical.o \
ia32/process.o \
ia32/thread.o
STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
# Ideally, this would be -lwhatever, but we have not started patching
# the GNU tools yet...
LIBS =
HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
# TODO: Those should be overridable.
CC = gcc
NASM = nasm
AR = ar
RANLIB = ranlib
GZIP = gzip -f
%.o: %.c
@echo Compiling $<...
@$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
@$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
%.o: %.S
@echo Compiling $<...
@$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
@$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
%.o: %.asm
$(NASM) -o $(@) $< -f elf
.PHONY: splash all clean install package-source package-check package
all: splash makefile
@for sub_directory in $(SUB_DIRECTORIES) ; do (cd $$sub_directory && echo -e "\n Compiling directory: $$sub_directory\n" && $(MAKE)) || exit ; done
@$(MAKE) stormG2
clean: makefile
@for sub_directory in $(SUB_DIRECTORIES) ; do (cd $$sub_directory && $(MAKE) clean) || exit ; done
rm -f stormG2
rm -f *.dep
-$(MAKE) clean-local
makefile: configure
@./configure
splash:
@echo -e "\n Compiling kernel: stormG2...\n"
configure: autochaos.rules
@autochaos
LDFLAGS = -nostdlib -Wl,-T,current-arch/kernel.ld -lgcc -Wn $(EXTRA_LDFLAGS)
stormG2: $(OBJECTS) $(ALL_OBJECTS)
@echo "Linking..."
@$(CC) -o $(@) $(OBJECTS) $(ALL_OBJECTS) $(LIBS) $(LDFLAGS)
install: all
@for sub_directory in $(SUB_DIRECTORIES) ; do (cd $$sub_directory && $(MAKE) install) || exit ; done
mkdir -p $(PREFIX)/system/kernel
cp stormG2 $(PREFIX)/system/kernel
strip -R .note -R .comment -R .eh_frame $(PREFIX)/system/kernel/stormG2
$(GZIP) $(PREFIX)/system/kernel/stormG2 # > $(PREFIX)/system/kernel/stormG2.gz
package-source:
@for sub_directory in $(SUB_DIRECTORIES) ; do (cd $$sub_directory && $(MAKE) package-source) || exit ; done
mkdir -p /home/plundis/Projects/chaos/stormG2/package-source/.
-cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/plundis/Projects/chaos/stormG2/package-source/.
-cp -f makefile.template $(EXTRA_FILES) /home/plundis/Projects/chaos/stormG2/package-source/.
package-check: package-source
cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
find package-source -name makefile -exec rm {} ';'
rm package-source/config.h
package: package-check
rm -rf stormG2-0.0.1
mv package-source stormG2-0.0.1
tar cvIf stormG2-0.0.1.tar.bz2 stormG2-0.0.1
# $Id$
# Local rules.
stormG2: current-arch
# FIXME: Make this detect the architecture in some way.
current-arch:
ln -sf ia32 current-arch
clean-local:
rm -f current-arch