Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created October 15, 2024 04:59
Show Gist options
  • Select an option

  • Save jordansissel/23b15c7fed9dad48017283fd65d068a5 to your computer and use it in GitHub Desktop.

Select an option

Save jordansissel/23b15c7fed9dad48017283fd65d068a5 to your computer and use it in GitHub Desktop.

Revisions

  1. jordansissel created this gist Oct 15, 2024.
    20 changes: 20 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    # 'gem list -i foo' will print 'true' if a gem is already installed. 'false' otherwise

    GEMS=clamp rake

    # From the GEMS list, generate a list of make targets
    TARGETS=$(foreach gem,$(GEMS),gem-$(shell gem list -i $(gem))-$(gem))
    build: $(TARGETS)
    build:
    @echo "=> OK to build"

    .PHONY: gem-false-%
    gem-false-%: GEM=$(@:gem-false-%=%)
    gem-false-%:
    @echo Installing "$(GEM)"
    gem install $(GEM)

    .PHONY: gem-true-%
    gem-true-%: GEM=$(@:gem-true-%=%)
    gem-true-%:
    @echo "Found $(GEM)"