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