Luna/apps/Makefile

35 lines
628 B
Makefile

APPS := init
APPS_DIR := $(LUNA_ROOT)/apps
APPS_OBJ := $(APPS_DIR)/lib
APPS_BIN := $(APPS_DIR)/bin
CC := x86_64-luna-gcc
CXX := x86_64-luna-g++
ASM := nasm
AR := x86_64-luna-ar
LD := x86_64-luna-ld
REAL_APPS := $(patsubst %, $(APPS_BIN)/%, $(APPS))
ASMFLAGS := -felf64
APP_LDFLAGS := -nostdlib
$(APPS_OBJ)/%.o: $(APPS_DIR)/%.asm
@mkdir -p $(@D)
nasm $(ASMFLAGS) -o $@ $^
$(APPS_BIN)/%: $(APPS_OBJ)/%.o
@mkdir -p $(@D)
$(LD) $(APP_LDFLAGS) -o $@ $^
build: $(REAL_APPS)
install: $(REAL_APPS)
@mkdir -p $(LUNA_ROOT)/initrd/bin
cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
clean:
rm -f $(APPS_OBJ)/*
rm -f $(APPS_BIN)/*