Skip to content

Instantly share code, notes, and snippets.

@AnrDaemon
Created May 24, 2020 11:56
Show Gist options
  • Save AnrDaemon/10ce8011e5558aa7cbe5c58914b611b4 to your computer and use it in GitHub Desktop.
Save AnrDaemon/10ce8011e5558aa7cbe5c58914b611b4 to your computer and use it in GitHub Desktop.

Revisions

  1. AnrDaemon created this gist May 24, 2020.
    25 changes: 25 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    SHELL := /bin/sh
    .SHELLFLAGS := -ec
    .ONESHELL:

    PHAR_FILES := index.php

    clean:
    -rm index.php example.phar

    dist-clean: clean
    -rm stub.php

    release: release-phar

    release-phar: example.phar

    stub: stub.php

    %.php: %.sample.php
    cp "$<" "$@"

    example.phar: stub.php $(PHAR_FILES)
    phar pack -f "$@" -c bzip2 -s $^

    .PHONY: clean dist-clean stub release ;
    6 changes: 6 additions & 0 deletions index.sample.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <?php

    print __DIR__ . "\n";
    print __FILE__ . "\n";
    print getcwd() . "\n";
    var_dump(stream_resolve_include_path(basename(__FILE__)));
    5 changes: 5 additions & 0 deletions stub.sample.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    <?php

    require_once 'phar://' . __FILE__ . '/index.php';

    __HALT_COMPILER(); ?>