blob: 00ecc953bd413c143b6b48ab82a6a13fc1cc4e5a (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 | class Vavrdiasm < Formula
  homepage "https://github.com/vsergeev/vAVRdisasm"
  url "https://github.com/vsergeev/vavrdisasm/archive/v3.1.tar.gz"
  sha1 "8ac78c7ec26760ac76e25a1ff399cfc255b2bc52"
  bottle do
    cellar :any
    sha1 "3cd688a816ee9f7a4046db6170e8d42467877ee5" => :yosemite
    sha1 "840d8e147085e86941da55763625d82e44b2ca79" => :mavericks
    sha1 "5ce2eed553cbe8e522b29106eda55b559ce55ac5" => :mountain_lion
  end
  # Patch:
  # - BSD `install(1)' does not have a GNU-compatible `-D' (create intermediate
  #   directories) flag. Switch to using `mkdir -p'.
  # - Make `PREFIX' overridable
  #   https://github.com/vsergeev/vavrdisasm/pull/2
  patch :DATA
  def install
    ENV["PREFIX"] = prefix
    system "make"
    system "make", "install"
  end
  test do
    # Code to generate `file.hex':
    ## .device ATmega88
    ##
    ## LDI     R16, 0xfe
    ## SER     R17
    #
    # Compiled with avra:
    ## avra file.S && mv file.S.hex file.hex
    (testpath/"file.hex").write <<-EOS.undent
      :020000020000FC
      :040000000EEF1FEFF1
      :00000001FF
    EOS
    output = `vavrdisasm file.hex`.lines.to_a
    assert output[0].match(/ldi\s+R16,\s0xfe/).length == 1
    assert output[1].match(/ser\s+R17/).length == 1
  end
end
__END__
diff --git a/Makefile b/Makefile
index 3b61942..f1c94fc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 PROGNAME = vavrdisasm
-PREFIX = /usr
+PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 ################################################################################
@@ -35,7 +35,8 @@ test: $(PROGNAME)
 	python2 crazy_test.py
 install: $(PROGNAME)
-	install -D -s -m 0755 $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME)
+	mkdir -p $(DESTDIR)$(BINDIR)
+	install -s -m 0755 $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME)
 uninstall:
 	rm -f $(DESTDIR)$(BINDIR)/$(PROGNAME)
 |