62 lines
1.6 KiB
Makefile
62 lines
1.6 KiB
Makefile
# This build script uses some GNU make specific extensions.
|
|
|
|
include config.mk
|
|
|
|
CFLAGS += -ggdb
|
|
|
|
# Kernel sources which are specific to the x86_64 architecture.
|
|
# Add new source files (C or Assembler) here,
|
|
# preferentially in alphabetical order.
|
|
VISOR_SOURCES_x86_64 := \
|
|
# end of x86_64 specific sources list
|
|
|
|
# Architecture-agnostic kernel sources.
|
|
# Add new source files (C or Assembler) here,
|
|
# preferentially in alphabetical order.
|
|
VISOR_SOURCES := \
|
|
efi.c \
|
|
$(VISOR_SOURCES_$(ARCH)) \
|
|
# end of sources list
|
|
|
|
VISOR_OBJECTS := $(VISOR_SOURCES:.c=.o)
|
|
VISOR_OBJECTS := $(VISOR_OBJECTS:.S=.o)
|
|
VISOR_OBJECTS := $(VISOR_OBJECTS:%.o=build/%.o)
|
|
VISOR_DEPFILES := $(VISOR_OBJECTS:.o=.d)
|
|
VISOR_TARGET := build/visor
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(VISOR_TARGET)
|
|
|
|
clean:
|
|
rm -f $(VISOR_OBJECTS)
|
|
rm -f $(VISOR_DEPFILES)
|
|
rm -f build/visor.so
|
|
rm -f $(VISOR_TARGET)
|
|
|
|
build/%.o: %.[cS] | build
|
|
@printf "CC %s\n" $@
|
|
@"$(CC)" $(CFLAGS) -MMD -MP -c -o $@ $< $(CPPFLAGS)
|
|
|
|
build/$(ARCH)/%.o: $(ARCH)/%.[cS] | build/$(ARCH)
|
|
@printf "CC %s\n" $@
|
|
@"$(CC)" $(CFLAGS) -MMD -MP -c -o $@ $< $(CPPFLAGS)
|
|
|
|
build/visor.so: $(VISOR_OBJECTS) gnuefi/crt0-efi-$(ARCH).o | build
|
|
@printf "LD %s\n" $@
|
|
@"$(LD)" $(LDFLAGS) -o $@ gnuefi/crt0-efi-$(ARCH).o $(VISOR_OBJECTS)
|
|
|
|
$(VISOR_TARGET): build/visor.so | build
|
|
@printf "ELF->PE %s\n" $@
|
|
@objcopy -j .text -j .sdata -j .data -j .rodata -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-x86_64 --subsystem 10 build/visor.so $@
|
|
|
|
build:
|
|
mkdir -p $@
|
|
|
|
build/$(ARCH):
|
|
mkdir -p $@
|
|
|
|
config.mk: | config.default.mk
|
|
cp config.default.mk $@
|
|
|
|
-include $(VISOR_DEPFILES)
|