2022-11-09 11:01:48 +00:00
|
|
|
C_APPS := init sh uname uptime hello ps ls args cat stat su session date mkdir screen
|
|
|
|
CXX_APPS := hello-cpp
|
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
|
|
|
|
|
2022-11-09 11:01:48 +00:00
|
|
|
C_APPS_PATH := $(patsubst %, $(APPS_BIN)/%, $(C_APPS))
|
|
|
|
CXX_APPS_PATH := $(patsubst %, $(APPS_BIN)/%, $(CXX_APPS))
|
2022-09-30 15:43:14 +00:00
|
|
|
|
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-11-09 11:01:48 +00:00
|
|
|
CXXFLAGS := -fno-exceptions
|
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-11-09 11:01:48 +00:00
|
|
|
$(APPS_BIN)/%: $(APPS_SRC)/%.cpp
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
@$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ $^
|
|
|
|
@echo " CXX $^"
|
|
|
|
|
|
|
|
build: $(C_APPS_PATH) $(CXX_APPS_PATH)
|
2022-09-30 15:43:14 +00:00
|
|
|
|
2022-11-09 11:01:48 +00:00
|
|
|
install: $(C_APPS_PATH) $(CXX_APPS_PATH)
|
2022-09-30 15:43:14 +00:00
|
|
|
@mkdir -p $(LUNA_ROOT)/initrd/bin
|
2022-11-09 11:01:48 +00:00
|
|
|
@cp $(C_APPS_PATH) $(CXX_APPS_PATH) $(LUNA_ROOT)/initrd/bin
|
2022-11-10 16:55:41 +00:00
|
|
|
@echo " INSTALL $(C_APPS) $(CXX_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)/*
|