Refactored Makefile & Added run configurations
This commit is contained in:
parent
e576b3b4c0
commit
eb061171a5
5 changed files with 89 additions and 24 deletions
10
.idea/runConfigurations/Build_Redist.xml
generated
Normal file
10
.idea/runConfigurations/Build_Redist.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Build Redist" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
|
||||
<makefile filename="$PROJECT_DIR$/Makefile" target="redist" workingDirectory="" arguments="">
|
||||
<envs />
|
||||
</makefile>
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
10
.idea/runConfigurations/Build_Tarball.xml
generated
Normal file
10
.idea/runConfigurations/Build_Tarball.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Build Tarball" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
|
||||
<makefile filename="$PROJECT_DIR$/Makefile" target="tar" workingDirectory="" arguments="">
|
||||
<envs />
|
||||
</makefile>
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
8
.idea/runConfigurations/Clean.xml
generated
Normal file
8
.idea/runConfigurations/Clean.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Clean" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" activateToolWindowBeforeRun="false">
|
||||
<makefile filename="$PROJECT_DIR$/Makefile" target="clean" workingDirectory="" arguments="">
|
||||
<envs />
|
||||
</makefile>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
10
.idea/runConfigurations/Rebuild_Autoloaders.xml
generated
Normal file
10
.idea/runConfigurations/Rebuild_Autoloaders.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Rebuild Autoloaders" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
|
||||
<makefile filename="$PROJECT_DIR$/Makefile" target="autoload" workingDirectory="" arguments="">
|
||||
<envs />
|
||||
</makefile>
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
75
Makefile
75
Makefile
|
@ -1,21 +1,37 @@
|
|||
# Variables
|
||||
PHPCC := $(shell which php)
|
||||
PHPAB := $(shell which phpab)
|
||||
BUILD_PATH := build
|
||||
SRC_PATH := src
|
||||
INSTALLER_PATH := $(SRC_PATH)/installer
|
||||
CONFIG_PATH := $(SRC_PATH)/config
|
||||
TIMESTAMP := $(shell date +%Y%m%d%H%M%S)
|
||||
|
||||
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
|
||||
# List of paths for autoloading
|
||||
AUTOLOAD_PATHS := $(addprefix $(SRC_PATH)/ncc/ThirdParty/, \
|
||||
defuse/php-encryption \
|
||||
jelix/version \
|
||||
nikic/PhpParser \
|
||||
Symfony/polyfill-ctype \
|
||||
Symfony/polyfill-mbstring \
|
||||
Symfony/polyfill-uuid \
|
||||
Symfony/Process \
|
||||
Symfony/Uid \
|
||||
Symfony/Filesystem \
|
||||
Symfony/Yaml \
|
||||
theseer/Autoload \
|
||||
theseer/DirectoryScanner \
|
||||
)
|
||||
|
||||
# Check for necessary binaries
|
||||
ifndef PHPCC
|
||||
$(error "PHP binary not found. Please install PHP or check your PATH")
|
||||
endif
|
||||
ifndef PHPAB
|
||||
$(error "phpab (PHP Autoload Builder) binary not found. Please install phpab or check your PATH")
|
||||
endif
|
||||
|
||||
# Build rules
|
||||
$(SRC_PATH)/%/autoload_spl.php:
|
||||
$(PHPCC) $(PHPAB) --output $@ $(SRC_PATH)/$*
|
||||
|
||||
|
@ -34,38 +50,49 @@ $(SRC_PATH)/ncc/autoload_spl.php:
|
|||
$(SRC_PATH)/ncc/ncc.php \
|
||||
$(SRC_PATH)/ncc/Runtime.php
|
||||
|
||||
# Phony targets
|
||||
.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
|
||||
cp -f $(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)/installer/extension $(BUILD_PATH)/src/extension
|
||||
cp -f $(INSTALLER_PATH)/installer $(BUILD_PATH)/src/INSTALL
|
||||
cp -f $(INSTALLER_PATH)/ncc.sh $(BUILD_PATH)/src/ncc.sh
|
||||
cp -f $(CONFIG_PATH)/ncc.yaml $(BUILD_PATH)/src/default_config.yaml
|
||||
cp -f $(CONFIG_PATH)/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml
|
||||
cp -f $(INSTALLER_PATH)/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
|
||||
cp -f LICENSE $(BUILD_PATH)/src/LICENSE
|
||||
cp -f README.md $(BUILD_PATH)/src/README.md
|
||||
cp -f $(INSTALLER_PATH)/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
|
||||
cp -f $(INSTALLER_PATH)/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
|
||||
|
||||
$(BUILD_PATH)/build_$(TIMESTAMP).tar.gz: redist
|
||||
cd $(BUILD_PATH)/src; tar -czvf ../build_$(TIMESTAMP).tar.gz *
|
||||
|
||||
.PHONY: tar
|
||||
tar: redist
|
||||
cd $(BUILD_PATH)/src; tar -czvf ../build.tar.gz *
|
||||
tar: $(BUILD_PATH)/build_$(TIMESTAMP).tar.gz
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(BUILD_PATH)
|
||||
rm -f $(SRC_PATH)/ncc/autoload_spl.php
|
||||
rm -f $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS))
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make autoload - Generate autoload files"
|
||||
@echo " make redist - Prepare the project for redistribution"
|
||||
@echo " make tar - Package the project into a tarball with timestamp"
|
||||
@echo " make clean - Clean the build artifacts"
|
Loading…
Add table
Reference in a new issue