mirror of
https://github.com/mjsarfatti/beddu.git
synced 2025-06-26 17:08:01 +02:00
Initial commit - v1.0
This commit is contained in:
commit
76d136f64c
20 changed files with 1350 additions and 0 deletions
47
Makefile
Normal file
47
Makefile
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Beddu build Makefile
|
||||
|
||||
OUT_DIR = build
|
||||
OUTPUT = $(OUT_DIR)/beddu.sh
|
||||
SRC_DIR = src
|
||||
DEMO_DIR = demo
|
||||
|
||||
# Find all direct subdirectories of src and sort them alphabetically
|
||||
SUBDIRS = $(sort $(dir $(wildcard $(SRC_DIR)/*/)))
|
||||
|
||||
# Define a function to get files from a specific directory
|
||||
get_dir_files = $(wildcard $(1)*.sh)
|
||||
|
||||
# Build ALL_SRC_FILES by including files from each subdirectory in order
|
||||
ALL_SRC_FILES = $(foreach dir,$(SUBDIRS),$(call get_dir_files,$(dir)))
|
||||
|
||||
.PHONY: all clean demo build
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
||||
build:
|
||||
@$(MAKE) clean
|
||||
@$(MAKE) all
|
||||
|
||||
demo: build
|
||||
@./$(DEMO_DIR)/demo.sh
|
||||
|
||||
$(OUTPUT): $(ALL_SRC_FILES)
|
||||
@mkdir -p $(OUT_DIR)
|
||||
@echo '#! /usr/bin/env bash' > $(OUTPUT)
|
||||
@echo '# shellcheck disable=all' >> $(OUTPUT)
|
||||
@echo '#' >> $(OUTPUT)
|
||||
@echo '# beddu.sh - A lightweight bash framework for interactive scripts and pretty output' >> $(OUTPUT)
|
||||
@echo '# https://github.com/mjsarfatti/beddu' >> $(OUTPUT)
|
||||
@echo '#' >> $(OUTPUT)
|
||||
@echo '# Generated on: $(shell date)' >> $(OUTPUT)
|
||||
@# Process each file, stripping (line) comments and empty lines
|
||||
@for file in $(ALL_SRC_FILES); do \
|
||||
echo "" >> $(OUTPUT); \
|
||||
grep -v '^\s*#' "$$file" | sed '/^[[:space:]]*$$/d' | sed 's/#[a-zA-Z0-9 ]*$$//' >> $(OUTPUT); \
|
||||
done
|
||||
@chmod +x $(OUTPUT)
|
||||
@echo "\nBuild complete: \033[32m$(OUTPUT)\033[0m"
|
||||
|
||||
clean:
|
||||
@rm -rf $(OUT_DIR)
|
||||
@echo "\nClean up completed."
|
Loading…
Add table
Add a link
Reference in a new issue