@@ -23,9 +23,11 @@ ifeq ($(CC),gcc) export COMPLIB = -lgcc endif -all: defs obj tool +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: @@ -49,10 +51,14 @@ %.calls: arch/makefile cd arch && $(MAKE) $(TMP)/calls.$*.s -$(OUT)/libk.so: obj $(OUT) - $(CC) -shared -nostdlib $(COMPLIB) -o $@ $(OUT)/*.o +$(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