20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
endif
# include libgcc.a in gcc builds, just in case
ifeq ($(CC),gcc)
export COMPLIB = -lgcc
endif
all: defs obj tool
obj: $(moddirs:%=%.obj)
defs: $(moddirs:%=%.def)
tool: $(OUT)/libk.a $(binmods:%=%.tool)
clean:
rm -rf $(TMP) $(OUT)
lists = moddirs objects binaries binmods POSIX
................................................................................
%.def: %/makefile $(OUT) $(OUT)/k
cd $* && $(MAKE) def
%.calls: arch/makefile
cd arch && $(MAKE) $(TMP)/calls.$*.s
$(OUT)/libk.so: obj $(OUT)
$(CC) -shared -nostdlib $(COMPLIB) -o $@ $(OUT)/*.o
$(OUT)/libk.a: obj $(OUT)
# using `ar rc` and ranlib here instead of
# `ar rcs` in case `ar` isn't the GNU version
ar rc $@ $(OUT)/*.o
ranlib $@
$(OUT) $(OUT)/k:
mkdir -p $@
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
endif
# include libgcc.a in gcc builds, just in case
ifeq ($(CC),gcc)
export COMPLIB = -lgcc
endif
all: defs obj tool lib.static lib.shared
lib.static: defs obj $(OUT)/libk.a
lib.shared: defs obj $(OUT)/libk.so
obj: $(moddirs:%=%.obj)
defs: $(moddirs:%=%.def)
tool: $(OUT)/libk.a $(binmods:%=%.tool)
clean:
rm -rf $(TMP) $(OUT)
lists = moddirs objects binaries binmods POSIX
................................................................................
%.def: %/makefile $(OUT) $(OUT)/k
cd $* && $(MAKE) def
%.calls: arch/makefile
cd arch && $(MAKE) $(TMP)/calls.$*.s
$(OUT)/libk.so: obj $(OUT) $(OUT)/boot.o
ld -shared $(COMPLIB) -o $@ $(filter-out kcore.boot.%, $(wildcard *.o))
# $(CC) -shared -fPIC -nostdlib $(COMPLIB) -o $@ $(OUT)/*.o
$(OUT)/boot.o: $(OUT)/kcore.boot.o $(OUT)/kcore.boot.$(TARGET).o
ld -r $^ -o $(OUT)/boot.o
$(OUT)/libk.a: obj $(OUT)
# using `ar rc` and ranlib here instead of
# `ar rcs` in case `ar` isn't the GNU version
ar rc $@ $(OUT)/*.o
ranlib $@
$(OUT) $(OUT)/k:
mkdir -p $@
|