Skip to content

Instantly share code, notes, and snippets.

@davesnx
Last active June 27, 2025 02:52
Show Gist options
  • Select an option

  • Save davesnx/643af12dca2a7cfcd481fd3949b81f82 to your computer and use it in GitHub Desktop.

Select an option

Save davesnx/643af12dca2a7cfcd481fd3949b81f82 to your computer and use it in GitHub Desktop.

Revisions

  1. davesnx renamed this gist Nov 22, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. davesnx revised this gist Nov 9, 2021. 2 changed files with 24 additions and 2 deletions.
    20 changes: 18 additions & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,22 @@
    .PHONY: help
    .PHONY: help # Set default action to be help!

    help:
    @echo "List of available make commands";
    @echo "";
    @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
    @echo "";
    @echo "";

    # Add double ## comments on the same line as the dependencies and will be printed out when running help
    # Don't add them if you don't want to appear on help!

    ##### Some placeholder actions #####

    build: ## Build the project
    @echo "build project"

    clean: ## Clean the artifacts
    @echo "clean"

    test:
    @echo "running tests..."
    @echo "GREEN"
    6 changes: 6 additions & 0 deletions stdout.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    make
    List of available make commands

    build Build the project
    clean Clean the artifacts
    test Test the project
  3. davesnx revised this gist Aug 31, 2021. 1 changed file with 0 additions and 75 deletions.
    75 changes: 0 additions & 75 deletions Example_Makefile
    Original file line number Diff line number Diff line change
    @@ -1,75 +0,0 @@
    .DEFAULT_GOAL := help

    project_name = open-graph-images-generator
    opam_file = $(project_name).opam
    DUNE = opam exec -- dune

    .PHONY: help
    help:
    @echo "";
    @echo "List of available make commands";
    @echo "";
    @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
    @echo "";

    .PHONY: init
    init: ## Create a local opam switch and install dev dependencies
    @opam switch create . 4.12.0 --deps-only
    @opam install ocaml-lsp-server dune

    .PHONY: install
    install: ## Install dependencies
    @opam install . --deps-only --with-doc --with-test --locked -y

    .PHONY: build
    build: ## Build the app
    $(DUNE) build @all

    .PHONY: watch
    watch: ## Watch the fs and re-run the server
    @watchexec -w source \
    --exts re,rei,ml,mli,json -r -c \
    "clear; $(MAKE) run-debug"

    .PHONY: test
    test: ## Run unit tests
    @echo "No tests implemented"
    @$(DUNE) test --force

    .PHONY: run
    run: ## Run the server
    @$(DUNE) exec $(project_name)

    .PHONY: run-debug
    run-debug:
    @$(DUNE) exec $(project_name) -- --debug

    # .PHONY: migrate
    # migrate: # Run the database migrations defined in migrate/migrate.ml
    # @$(DUNE) exec migrate

    # .PHONY: rollback
    # rollback: # Run the database rollback defined in migrate/rollback.ml
    # @$(DUNE) exec rollback

    .PHONY: deps
    # Alias to update the opam file and install the needed deps
    deps: update-opam-file install

    .PHONY: clean
    clean:
    $(DUNE) clean

    #docker_clean:
    # @docker container ls -qa | xargs -n1 docker container stop
    # @docker container ls -qa | xargs -n1 docker container rm
    # @docker volume ls -q | xargs -n1 docker volume rm
    #
    #down:
    # @docker compose -f docker-compose.dev.yml down
    #
    # up:
    # @docker compose -f docker-compose.dev.yml -p $(project_name) up

    update-opam-file: # Update the package dependencies when new deps are added to dune-project
    @$(DUNE) build @install # Update the $(project_name).opam file
  4. davesnx created this gist Aug 31, 2021.
    75 changes: 75 additions & 0 deletions Example_Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    .DEFAULT_GOAL := help

    project_name = open-graph-images-generator
    opam_file = $(project_name).opam
    DUNE = opam exec -- dune

    .PHONY: help
    help:
    @echo "";
    @echo "List of available make commands";
    @echo "";
    @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
    @echo "";

    .PHONY: init
    init: ## Create a local opam switch and install dev dependencies
    @opam switch create . 4.12.0 --deps-only
    @opam install ocaml-lsp-server dune

    .PHONY: install
    install: ## Install dependencies
    @opam install . --deps-only --with-doc --with-test --locked -y

    .PHONY: build
    build: ## Build the app
    $(DUNE) build @all

    .PHONY: watch
    watch: ## Watch the fs and re-run the server
    @watchexec -w source \
    --exts re,rei,ml,mli,json -r -c \
    "clear; $(MAKE) run-debug"

    .PHONY: test
    test: ## Run unit tests
    @echo "No tests implemented"
    @$(DUNE) test --force

    .PHONY: run
    run: ## Run the server
    @$(DUNE) exec $(project_name)

    .PHONY: run-debug
    run-debug:
    @$(DUNE) exec $(project_name) -- --debug

    # .PHONY: migrate
    # migrate: # Run the database migrations defined in migrate/migrate.ml
    # @$(DUNE) exec migrate

    # .PHONY: rollback
    # rollback: # Run the database rollback defined in migrate/rollback.ml
    # @$(DUNE) exec rollback

    .PHONY: deps
    # Alias to update the opam file and install the needed deps
    deps: update-opam-file install

    .PHONY: clean
    clean:
    $(DUNE) clean

    #docker_clean:
    # @docker container ls -qa | xargs -n1 docker container stop
    # @docker container ls -qa | xargs -n1 docker container rm
    # @docker volume ls -q | xargs -n1 docker volume rm
    #
    #down:
    # @docker compose -f docker-compose.dev.yml down
    #
    # up:
    # @docker compose -f docker-compose.dev.yml -p $(project_name) up

    update-opam-file: # Update the package dependencies when new deps are added to dune-project
    @$(DUNE) build @install # Update the $(project_name).opam file
    6 changes: 6 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    .PHONY: help
    help:
    @echo "List of available make commands";
    @echo "";
    @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
    @echo "";