projects/guix·blob python-team · refs

110 lines · 3.4 KiB

1Enables generating Lua's pkg-config file.
2
3http://lua-users.org/lists/lua-l/2015-03/msg00338.html
4
5--- a/Makefile 2022-01-03 12:06:37.760402709 +0000
6+++ b/Makefile 2022-01-03 12:06:49.568402167 +0000
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= guess aix bsd c89 freebsd generic linux linux-readline 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_LIB= liblua.a liblua.so liblua.so.${V}
26+TO_PC= lua-$(V).pc
27 TO_MAN= lua.1 luac.1
28
29 # Lua version and release.
30@@ -51,20 +55,26 @@
31 # Targets start here.
32 all: $(PLAT)
33
34-$(PLATS) help test clean:
35- @cd src && $(MAKE) $@
36+$(PLATS):
37+ @cd src && $(MAKE) $@ V=$(V) R=$(R)
38
39-install: dummy
40- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
41+clean:
42+ cd src && $(MAKE) $@
43+ $(RM) $(TO_PC)
44+
45+install: dummy $(TO_PC)
46+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
47 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
48 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
49- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
50+ cd src && $(INSTALL_EXEC) $(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@@ -82,11 +92,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@@ -95,12 +107,29 @@
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
106 # Targets that do not create files (not all makes understand .PHONY).
107-.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc
108+.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc pkg-config
109
110 # (end of Makefile)