2022-11-02 20:00:23 +00:00
|
|
|
APPS := init sh uname uptime hello ps ls args cat stat su session date mkdir screen
|
2022-09-30 15:43:14 +00:00
|
|
|
|
|
|
|
APPS_DIR := $(LUNA_ROOT)/apps
|
2022-10-02 15:25:56 +00:00
|
|
|
APPS_SRC := $(APPS_DIR)/src
|
2022-09-30 15:43:14 +00:00
|
|
|
APPS_BIN := $(APPS_DIR)/bin
|
|
|
|
|
|
|
|
REAL_APPS := $(patsubst %, $(APPS_BIN)/%, $(APPS))
|
|
|
|
|
2022-11-08 16:39:34 +00:00
|
|
|
CFLAGS := -Wall -Wextra -Werror -Os -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections
|
2022-09-30 15:43:14 +00:00
|
|
|
|
2022-10-02 15:25:56 +00:00
|
|
|
$(APPS_BIN)/%: $(APPS_SRC)/%.c
|
2022-09-30 15:43:14 +00:00
|
|
|
@mkdir -p $(@D)
|
2022-11-08 17:03:43 +00:00
|
|
|
@$(CC) $(CFLAGS) -o $@ $^
|
|
|
|
@echo " CC $^"
|
2022-09-30 15:43:14 +00:00
|
|
|
|
2022-10-02 10:44:32 +00:00
|
|
|
build: $(REAL_APPS)
|
2022-09-30 15:43:14 +00:00
|
|
|
|
2022-10-02 10:44:32 +00:00
|
|
|
install: $(REAL_APPS)
|
2022-09-30 15:43:14 +00:00
|
|
|
@mkdir -p $(LUNA_ROOT)/initrd/bin
|
2022-11-08 17:03:43 +00:00
|
|
|
@cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
|
|
|
|
@echo " INSTALL $(REAL_APPS)"
|
2022-10-28 18:57:13 +00:00
|
|
|
@chmod a+s $(LUNA_ROOT)/initrd/bin/su
|
2022-09-30 15:43:14 +00:00
|
|
|
|
2022-10-02 10:44:32 +00:00
|
|
|
clean:
|
2022-09-30 15:43:14 +00:00
|
|
|
rm -f $(APPS_BIN)/*
|