-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
37 lines (27 loc) · 949 Bytes
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Makefile to concatenate JavaScript files and install them
# Source and destination directories
SRC_DIR := src
BUILD_DIR := build
# Final output file
OUTPUT_FILE := $(BUILD_DIR)/munduscraft-scripts.js
# Find all JavaScript files in the src/ directory
JS_FILES := $(shell find $(SRC_DIR) -name '*.js')
# Minecraft scripts directory (can be set as an environment variable)
MC_SCRIPT_DIR ?= $(shell read -p "Enter the Minecraft script directory: " dir; echo $$dir)
.PHONY: all clean install
all: $(OUTPUT_FILE)
$(OUTPUT_FILE): $(JS_FILES) | $(BUILD_DIR)
@echo "Concatenating JavaScript files..."
@cat $^ > $@
@echo "Build complete: $(OUTPUT_FILE)"
$(BUILD_DIR):
@echo "Creating build directory..."
@mkdir -p $@
clean:
@echo "Cleaning up..."
@rm -rf $(BUILD_DIR)
@echo "Clean complete."
install: $(OUTPUT_FILE)
@echo "Installing script to Minecraft directory..."
@cp $(OUTPUT_FILE) $(MC_SCRIPT_DIR)/
@echo "Installation complete."