#!/bin/sh # shmake - the "Simple helpful make system" aka "the shell make system" # A POSIX-compliant build system for C projects # Author: Emilia Marigold # License: AGPL-3.0 set -u SCRIPT_NAME="shmake" # Get script directory once SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) # Source all utility scripts . "$SCRIPT_DIR/shmake_source/shmake_utils.sh" . "$SCRIPT_DIR/shmake_source/shmake_help_message.sh" . "$SCRIPT_DIR/shmake_source/shmake_init_project.sh" . "$SCRIPT_DIR/shmake_source/shmake_add_module.sh" . "$SCRIPT_DIR/shmake_source/shmake_download_library.sh" . "$SCRIPT_DIR/shmake_source/shmake_link_library.sh" . "$SCRIPT_DIR/shmake_source/shmake_sync_makefile.sh" . "$SCRIPT_DIR/shmake_source/shmake_process_license.sh" #========================================================================================= # Main Entry Point #========================================================================================= main() { if [ $# -eq 0 ]; then help_message exit 0 fi case "$1" in help|--help|-h) help_message ;; init) init_project ;; module) shift add_module "$@" ;; library) shift add_library "$@" ;; link) shift add_linked_library "$@" ;; sync) sync_project ;; *) printf "Command unknown: %s\n" "$1" printf "Run '%s help' for usage.\n" "$SCRIPT_NAME" exit 1 ;; esac } main "$@"