Luna/apps/Makefile

35 lines
628 B
Makefile
Raw Normal View History

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
CC := x86_64-luna-gcc
CXX := x86_64-luna-g++
ASM := nasm
AR := x86_64-luna-ar
LD := x86_64-luna-ld
2022-09-30 15:43:14 +00:00
REAL_APPS := $(patsubst %, $(APPS_BIN)/%, $(APPS))
ASMFLAGS := -felf64
APP_LDFLAGS := -nostdlib
2022-09-30 15:43:14 +00:00
$(APPS_OBJ)/%.o: $(APPS_DIR)/%.asm
@mkdir -p $(@D)
nasm $(ASMFLAGS) -o $@ $^
2022-09-30 15:43:14 +00:00
$(APPS_BIN)/%: $(APPS_OBJ)/%.o
@mkdir -p $(@D)
$(LD) $(APP_LDFLAGS) -o $@ $^
build: $(REAL_APPS)
2022-09-30 15:43:14 +00:00
install: $(REAL_APPS)
2022-09-30 15:43:14 +00:00
@mkdir -p $(LUNA_ROOT)/initrd/bin
cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
clean:
2022-09-30 15:43:14 +00:00
rm -f $(APPS_OBJ)/*
rm -f $(APPS_BIN)/*