From e576b3b4c0525113d4a20a807e2976a501fbba5d Mon Sep 17 00:00:00 2001 From: Netkas Date: Wed, 16 Aug 2023 11:58:50 -0400 Subject: [PATCH] Cleaned up Makefile --- Makefile | 119 ++++++++++++++++--------------------------------------- 1 file changed, 35 insertions(+), 84 deletions(-) diff --git a/Makefile b/Makefile index f2a4382..d9b396d 100644 --- a/Makefile +++ b/Makefile @@ -1,75 +1,26 @@ -PHPCC:=$(shell which php) -PHPAB:=$(shell which phpab) -BUILD_PATH=build -SRC_PATH=src +PHPCC := $(shell which php) +PHPAB := $(shell which phpab) +BUILD_PATH := build +SRC_PATH := src -autoload: - # Generates/creates all the autoloader files - make $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php - make $(SRC_PATH)/ncc/autoload_spl.php - cp $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php +AUTOLOAD_PATHS := $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption \ + $(SRC_PATH)/ncc/ThirdParty/jelix/version \ + $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/Process \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem \ + $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml \ + $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload \ + $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner -$(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption - -$(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/jelix/version - -$(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Process - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php: - $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml - -$(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload - -$(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner +$(SRC_PATH)/%/autoload_spl.php: + $(PHPCC) $(PHPAB) --output $@ $(SRC_PATH)/$* $(SRC_PATH)/ncc/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/autoload_spl.php \ + $(PHPCC) $(PHPAB) --output $@ \ $(SRC_PATH)/ncc/Abstracts \ $(SRC_PATH)/ncc/Classes \ $(SRC_PATH)/ncc/CLI \ @@ -83,38 +34,38 @@ $(SRC_PATH)/ncc/autoload_spl.php: $(SRC_PATH)/ncc/ncc.php \ $(SRC_PATH)/ncc/Runtime.php +.PHONY: autoload +autoload: $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS)) $(SRC_PATH)/ncc/autoload_spl.php + cp $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php + +.PHONY: redist redist: autoload rm -rf $(BUILD_PATH)/src mkdir -p $(BUILD_PATH)/src cp -rf $(SRC_PATH)/ncc/* $(BUILD_PATH)/src cp $(SRC_PATH)/installer/installer $(BUILD_PATH)/src/INSTALL cp $(SRC_PATH)/installer/ncc.sh $(BUILD_PATH)/src/ncc.sh - cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/default_config.yaml; - cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml; + cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/default_config.yaml + cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml cp $(SRC_PATH)/installer/extension $(BUILD_PATH)/src/extension chmod +x $(BUILD_PATH)/src/INSTALL cp LICENSE $(BUILD_PATH)/src/LICENSE cp README.md $(BUILD_PATH)/src/README.md - cp $(SRC_PATH)/installer/hash_check.php $(BUILD_PATH)/src/hash_check.php; $(PHPCC) $(BUILD_PATH)/src/hash_check.php; rm $(BUILD_PATH)/src/hash_check.php - cp $(SRC_PATH)/installer/generate_build_files.php $(BUILD_PATH)/src/generate_build_files.php; $(PHPCC) $(BUILD_PATH)/src/generate_build_files.php; rm $(BUILD_PATH)/src/generate_build_files.php + cp $(SRC_PATH)/installer/hash_check.php $(BUILD_PATH)/src/hash_check.php + $(PHPCC) $(BUILD_PATH)/src/hash_check.php + rm $(BUILD_PATH)/src/hash_check.php + cp $(SRC_PATH)/installer/generate_build_files.php $(BUILD_PATH)/src/generate_build_files.php + $(PHPCC) $(BUILD_PATH)/src/generate_build_files.php + rm $(BUILD_PATH)/src/generate_build_files.php mkdir -p $(BUILD_PATH)/src/repositories cp -rf $(SRC_PATH)/default_repositories/*.json $(BUILD_PATH)/src/repositories +.PHONY: tar tar: redist cd $(BUILD_PATH)/src; tar -czvf ../build.tar.gz * +.PHONY: clean clean: rm -rf $(BUILD_PATH) rm -f $(SRC_PATH)/ncc/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php + rm -f $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS))