2022-09-30 15:43:14 +00:00
|
|
|
APPS := init
|
|
|
|
|
|
|
|
APPS_DIR := $(LUNA_ROOT)/apps
|
|
|
|
APPS_OBJ := $(APPS_DIR)/lib
|
|
|
|
APPS_BIN := $(APPS_DIR)/bin
|
|
|
|
|
|
|
|
REAL_APPS := $(patsubst %, $(APPS_BIN)/%, $(APPS))
|
|
|
|
|
|
|
|
ASMC := nasm
|
|
|
|
ASMFLAGS := -felf64
|
|
|
|
|
|
|
|
LD := x86_64-elf-ld
|
2022-10-01 10:17:16 +00:00
|
|
|
APP_LDFLAGS := -T$(APPS_DIR)/apps.ld -nostdlib -z max-page-size=0x1000
|
2022-09-30 15:43:14 +00:00
|
|
|
|
|
|
|
$(APPS_OBJ)/%.o: $(APPS_DIR)/%.asm
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(ASMC) $(ASMFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
$(APPS_BIN)/%: $(APPS_OBJ)/%.o
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(LD) $(APP_LDFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
apps-build: $(REAL_APPS)
|
|
|
|
|
|
|
|
apps-install: $(REAL_APPS)
|
|
|
|
@mkdir -p $(LUNA_ROOT)/initrd/bin
|
|
|
|
cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
|
|
|
|
|
|
|
|
apps-clean:
|
|
|
|
rm -f $(APPS_OBJ)/*
|
|
|
|
rm -f $(APPS_BIN)/*
|