compiler_minimum_required(3,0,0);
project('PMake: a build tool for (free) pascal', '0.0.2');

option('WITH_DEBUG', 'Enable debug info for PMake', _ON_);

//compile the pmake units
include_directories('lib_pmake', ['include']);
add_library('lib_pmake', ['compiler.pas', 'crc16.pas', 'depsolver.pas', 'make2_main.pas', 'make_main.pas', 'pmake_api.pas', 'pmake_main.pas', 'pmake_utilities.pas', 'pmake_variables.pas']);

//compile the pmake executable
add_executable('pmake', 'pmake', 'pmake.pp', ['lib_pmake']);

//create the package
create_package('pmake-$(PROJECT_VERSION)-$(PMAKE_HOST_SYSTEM_PROCESSOR)-$(PMAKE_HOST_SYSTEM_NAME)', '$(PMAKE_SOURCE_DIR)..\build\');

//install the compiled units and the pmake executable
install('$(BINOUTPUTDIR)', '$(PMAKE_PACKAGE_DIR)', 'pmake$(EXE)', 'pmake');
install('$(UNITSOUTPUTDIR)', '$(PMAKE_PACKAGE_DIR)', '*.o', 'lib_pmake');
install('$(UNITSOUTPUTDIR)', '$(PMAKE_PACKAGE_DIR)', '*.ppu', 'lib_pmake');
