C_APPS := init sh uname uptime hello ps ls args cat stat su session date mkdir screen CXX_APPS := hello-cpp APPS_DIR := $(LUNA_ROOT)/apps APPS_SRC := $(APPS_DIR)/src APPS_BIN := $(APPS_DIR)/bin C_APPS_PATH := $(patsubst %, $(APPS_BIN)/%, $(C_APPS)) CXX_APPS_PATH := $(patsubst %, $(APPS_BIN)/%, $(CXX_APPS)) CFLAGS := -Wall -Wextra -Werror -Os -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections CXXFLAGS := -fno-exceptions $(APPS_BIN)/%: $(APPS_SRC)/%.c @mkdir -p $(@D) @$(CC) $(CFLAGS) -o $@ $^ @echo " CC $^" $(APPS_BIN)/%: $(APPS_SRC)/%.cpp @mkdir -p $(@D) @$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ $^ @echo " CXX $^" build: $(C_APPS_PATH) $(CXX_APPS_PATH) install: $(C_APPS_PATH) $(CXX_APPS_PATH) @mkdir -p $(LUNA_ROOT)/initrd/bin @cp $(C_APPS_PATH) $(CXX_APPS_PATH) $(LUNA_ROOT)/initrd/bin @echo " INSTALL $(C_APPS) $(CXX_APPS)" @chmod a+s $(LUNA_ROOT)/initrd/bin/su clean: rm -f $(APPS_BIN)/*