Commit 241e1788 authored by Alex Bennée's avatar Alex Bennée Committed by Radim Krčmář
Browse files

Makefiles: fix up the x86 build dirs and include/link paths



We still need to tell the compiler the correct search path for finding
headers and the like. This is slightly complicated by the "dynamic"
asm search path which is in our build tree but (may be) symlinked to
the right architectures headers.

Also we explicitly include SRCDIR for the linking scripts as VPATH
doesn't seem to find them well enough.

Also update OBJDIRS to include lib/x86.

Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent c7eb0b74
...@@ -76,7 +76,7 @@ $(libcflat): $(cflatobjs) ...@@ -76,7 +76,7 @@ $(libcflat): $(cflatobjs)
$(AR) rcs $@ $^ $(AR) rcs $@ $^
include $(LIBFDT_srcdir)/Makefile.libfdt include $(LIBFDT_srcdir)/Makefile.libfdt
$(LIBFDT_archive): CFLAGS += -ffreestanding -I lib -I lib/libfdt -Wno-sign-compare $(LIBFDT_archive): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -Wno-sign-compare
$(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS)) $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
$(AR) rcs $@ $^ $(AR) rcs $@ $^
......
#This is a make file with common rules for both x86 & x86-64 #This is a make file with common rules for both x86 & x86-64
all: test_cases all: directories test_cases
cflatobjs += lib/pci.o cflatobjs += lib/pci.o
cflatobjs += lib/pci-edu.o cflatobjs += lib/pci-edu.o
...@@ -16,8 +16,10 @@ cflatobjs += lib/x86/isr.o ...@@ -16,8 +16,10 @@ cflatobjs += lib/x86/isr.o
cflatobjs += lib/x86/acpi.o cflatobjs += lib/x86/acpi.o
cflatobjs += lib/x86/stack.o cflatobjs += lib/x86/stack.o
OBJDIRS += lib/x86
$(libcflat): LDFLAGS += -nostdlib $(libcflat): LDFLAGS += -nostdlib
$(libcflat): CFLAGS += -ffreestanding -I lib $(libcflat): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I lib
CFLAGS += -m$(bits) CFLAGS += -m$(bits)
CFLAGS += -O1 CFLAGS += -O1
...@@ -31,8 +33,8 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) ...@@ -31,8 +33,8 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)
.PRECIOUS: %.elf %.o .PRECIOUS: %.elf %.o
FLATLIBS = lib/libcflat.a $(libgcc) FLATLIBS = lib/libcflat.a $(libgcc)
%.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o)
$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \
$(filter %.o, $^) $(FLATLIBS) $(filter %.o, $^) $(FLATLIBS)
%.flat: %.elf %.flat: %.elf
...@@ -52,14 +54,16 @@ ifdef API ...@@ -52,14 +54,16 @@ ifdef API
tests-common += api/api-sample tests-common += api/api-sample
tests-common += api/dirty-log tests-common += api/dirty-log
tests-common += api/dirty-log-perf tests-common += api/dirty-log-perf
OBJDIRS += api
endif endif
test_cases: $(tests-common) $(tests) test_cases: $(tests-common) $(tests)
$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I lib -I lib/x86 $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib
$(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
$(CC) -m32 -nostdlib -o $@ -Wl,-T,$(TEST_DIR)/realmode.lds $^ $(CC) -m32 -nostdlib -o $@ -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
$(TEST_DIR)/realmode.o: bits = 32 $(TEST_DIR)/realmode.o: bits = 32
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment