projects/guix·blob java-team · refs

109 lines · 3.2 KiB

1Enables generating Lua's pkg-config file.
2
3http://lua-users.org/lists/lua-l/2015-03/msg00338.html
4
5--- a/Makefile 2014-10-30 00:14:41.000000000 +0100
6+++ b/Makefile 2015-03-26 18:54:37.678374827 +0100
7@@ -14,6 +14,7 @@
8 INSTALL_BIN= $(INSTALL_TOP)/bin
9 INSTALL_INC= $(INSTALL_TOP)/include
10 INSTALL_LIB= $(INSTALL_TOP)/lib
11+INSTALL_PC= $(INSTALL_LIB)/pkgconfig
12 INSTALL_MAN= $(INSTALL_TOP)/man/man1
13 INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
14 INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
15@@ -39,9 +40,12 @@
16 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
17
18 # What to install.
19-TO_BIN= lua luac
20+INTERPRETER= lua
21+COMPILER= luac
22+TO_BIN= $(INTERPRETER) $(COMPILER)
23 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
24 TO_LIB= liblua.a
25+TO_PC= lua-$(V).pc
26 TO_MAN= lua.1 luac.1
27
28 # Lua version and release.
29@@ -51,23 +55,29 @@
30 # Targets start here.
31 all: $(PLAT)
32
33-$(PLATS) clean:
34+$(PLATS):
35 cd src && $(MAKE) $@
36
37+clean:
38+ cd src && $(MAKE) $@
39+ $(RM) $(TO_PC)
40+
41 test: dummy
42 src/lua -v
43
44-install: dummy
45- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
46+install: dummy $(TO_PC)
47+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
48 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
49 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
50 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
51+ cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
52 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
53
54 uninstall:
55 cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
56 cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
57 cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB)
58+ cd src && cd $(INSTALL_PC) && $(RM) $(TO_PC)
59 cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN)
60
61 local:
62@@ -90,11 +100,13 @@
63 @echo "TO_BIN= $(TO_BIN)"
64 @echo "TO_INC= $(TO_INC)"
65 @echo "TO_LIB= $(TO_LIB)"
66+ @echo "TO_PC= $(TO_PC)"
67 @echo "TO_MAN= $(TO_MAN)"
68 @echo "INSTALL_TOP= $(INSTALL_TOP)"
69 @echo "INSTALL_BIN= $(INSTALL_BIN)"
70 @echo "INSTALL_INC= $(INSTALL_INC)"
71 @echo "INSTALL_LIB= $(INSTALL_LIB)"
72+ @echo "INSTALL_PC= $(INSTALL_PC)"
73 @echo "INSTALL_MAN= $(INSTALL_MAN)"
74 @echo "INSTALL_LMOD= $(INSTALL_LMOD)"
75 @echo "INSTALL_CMOD= $(INSTALL_CMOD)"
76@@ -103,12 +115,28 @@
77
78 # echo pkg-config data
79 pc:
80- @echo "version=$R"
81- @echo "prefix=$(INSTALL_TOP)"
82- @echo "libdir=$(INSTALL_LIB)"
83- @echo "includedir=$(INSTALL_INC)"
84+ @echo 'prefix=$(INSTALL_TOP)'
85+ @echo 'libdir=$(INSTALL_LIB)'
86+ @echo 'includedir=$(INSTALL_INC)'
87+ @echo 'bindir=$(INSTALL_BIN)'
88+ @echo
89+ @echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
90+ @echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
91+ @echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
92+ @echo 'COMPILER=$${bindir}/$(COMPILER)'
93+ @echo
94+ @echo 'Name: Lua'
95+ @echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
96+ @echo 'Version: $(R)'
97+ @echo
98+ @echo 'Libs: -L$${libdir} -llua -lm'
99+ @echo 'Cflags: -I$${includedir}'
100+
101+pkg-config: $(TO_PC)
102+$(TO_PC):
103+ @$(MAKE) -s pc > $@
104
105 # list targets that do not create files (but not all makes understand .PHONY)
106-.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
107+.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho pkg-config
108
109 # (end of Makefile)