blob: 145bb6e336ac320aceeaf9b8f11391fe3dd4e28b (
plain) (
blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
PREFIX = /usr
DATA = /share
LIB = /lib
INCLUDE = /include
BIN = /bin
ENV = /usr$(BIN)/env
BASHSHEBANG = $(ENV) bash
PY3SHEBANG = $(ENV) python3
PKGNAME = argparser
LICENSES = $(PREFIX)$(DATA)
PY3VERSION = 3.3
LIBPY3 = $(PREFIX)$(LIB)/python$(PY3VERSION)
LIBBASH = $(PREFIX)$(LIB)
LIBJAVA = $(PREFIX)$(LIB)
LIBC = $(PREFIX)$(LIB)
VERSION = 1.0
C_OPTIMISE = -O6
JAVA_OPTIMISE = -O
JAVAC = javac
all: python bash java c doc
doc: info
info: argparser.info.gz
%.info.gz: info/%.texinfo
makeinfo "$<"
gzip -9 -f "$*.info"
python: bin/argparser.py
bin/argparser.py: src/argparser.py
cp "$<" "$@"
sed -i 's:^#!/usr/bin/env python3$$:#!$(PY3SHEBANG)":' "$@"
bash: bin/argparser.bash
bin/argparser.bash: src/argparser.bash
cp "$<" "$@"
sed -i 's:^#!/bin/bash$$:#!$(BASHSHEBANG)":' "$@"
java: bin/ArgParser.jar
bin/ArgParser.jar: src/argparser/ArgParser.java
@mkdir -p bin
$(JAVAC) $(JAVA_OPTIMISE) -cp src -s src -d bin src/argparser/ArgParser.java
$(JAVAC) $(JAVA_OPTIMISE) -cp src -s src -d bin src/Test.java
cd bin ; jar cf ArgParser.jar argparser/ArgParser*.class
c: bin/argparser.so
bin/argparser.so: src/argparser.c src/argparser.h
@mkdir -p bin
$(CC) $(C_OPTIMISE) -std=gnu99 -Wall -Wextra -pedantic -fPIC -c src/argparser.c -o bin/argparser.o
$(CC) $(C_OPTIMISE) -std=gnu99 -Wall -Wextra -pedantic -shared bin/argparser.o -o bin/argparser.so
$(CC) $(C_OPTIMISE) -std=gnu99 -Wall -Wextra -pedantic src/test.c bin/argparser.o -o bin/test
install: install-python install-bash install-java install-c install-license install-doc
install-python: bin/argparser.py
install -Dm644 bin/argparser.py "$(DESTDIR)$(LIBPY3)/argparser.py"
install-bash: bin/argparser.bash
install -Dm644 bin/argparser.bash "$(DESTDIR)$(LIBBASH)/argparser.bash"
install-java: bin/ArgParser.jar
install -Dm644 bin/ArgParser.jar "$(DESTDIR)$(LIBJAVA)/ArgParser.jar"
install-c: bin/argparser.so src/argparser.h
install -Dm644 bin/argparser.so "$(DESTDIR)$(LIBC)/libargparser.so.$(VERSION)"
ln -s "libargparser.so.$(VERSION)" "$(DESTDIR)$(LIBC)/libargparser.so"
install -Dm644 src/argparser.h "$(DESTDIR)$(PREFIX)$(INCLUDE)/argparser.h"
install-license:
install -d "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
install -m644 COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
install-doc: install-info
install-info: argparser.info.gz
install -Dm644 argparser.info.gz "$(DESTDIR)$(PREFIX)$(SHARE)/info/$(PKGNAME).info.gz"
uninstall: uninstall-python uninstall-bash uninstall-java uninstall-c uninstall-license uninstall-doc
uninstall-python:
rm -- "$(DESTDIR)$(LIBPY3)/argparser.py"
uninstall-bash:
rm -- "$(DESTDIR)$(LIBBASH)/argparser.bash"
uninstall-java:
rm -- "$(DESTDIR)$(LIBJAVA)/ArgParser.jar"
uninstall-c:
rm -- "$(DESTDIR)$(LIBC)/libargparser.so"
rm -- "$(DESTDIR)$(LIBC)/libargparser.so.1.0"
rm -- "$(DESTDIR)$(PREFIX)$(INCLUDE)/argparser.h"
uninstall-license:
rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE"
rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
-rmdir -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
uninstall-doc: uninstall-info
uninstall-info:
rm -- "$(DESTDIR)$(PREFIX)$(SHARE)/info/$(PKGNAME).info.gz"
clean:
-rm -r -- bin
|