Build libcrt.a instead of using separate object files.

This commit is contained in:
James Benton 2016-07-06 18:44:48 +01:00
parent 8aa77c9ee6
commit 5c91545658
2 changed files with 9 additions and 8 deletions

View File

@ -3,22 +3,23 @@ include $(WUT_ROOT)/rules/ppc.mk
CFILES := $(wildcard *.c)
SFILES := $(wildcard *.S)
CRT0 := crt0.o
OFILES := $(CFILES:.c=.o) $(SFILES:.S=.o)
OUTPUT := libcrt
STUBS := $(SFILES:.S=.o) $(CFILES:.c=.o)
all: $(STUBS) $(CRT0)
all: $(OUTPUT).a $(OFILES)
clean:
@echo "[RM] $(notdir $(CRT0))"
@rm -f $(STUBS) $(CRT0)
@echo "[RM] $(notdir $(OUTPUT))"
@rm -f $(OFILES) $(OUTPUT).a
install: all
@mkdir -p $(WUT_ROOT)/lib
@cp -f *.o $(WUT_ROOT)/lib
@cp -f *.a $(WUT_ROOT)/lib
%.o: %.S
@echo "[CC] $(notdir $<)"
@$(CC) $(CFLAGS) -c $< -o $@
$(OUTPUT).a: $(OFILES)
.PHONY: all clean

View File

@ -1,7 +1,7 @@
LIBPATHS := -L$(WUT_ROOT)/lib
CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding
CXXFLAGS := $(CFLAGS)
LDFLAGS := -nostdlib -nostartfiles $(WUT_ROOT)/lib/crt0.o $(WUT_ROOT)/lib/libgcc2.o -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64 -lcoreinit
LDFLAGS := -nostdlib -nostartfiles -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64 -lcoreinit -lcrt
ELF2RPL := $(WUT_ROOT)/bin/elf2rpl
include $(WUT_ROOT)/rules/base.mk