| 1 | # luaiconv - Performs character set conversions in Lua |
| 2 | # (c) 2005-10 Alexandre Erwin Ittner <[email protected]> |
| 3 | # |
| 4 | # Permission is hereby granted, free of charge, to any person obtaining |
| 5 | # a copy of this software and associated documentation files (the |
| 6 | # "Software"), to deal in the Software without restriction, including |
| 7 | # without limitation the rights to use, copy, modify, merge, publish, |
| 8 | # distribute, sublicense, and/or sell copies of the Software, and to |
| 9 | # permit persons to whom the Software is furnished to do so, subject to |
| 10 | # the following conditions: |
| 11 | # |
| 12 | # The above copyright notice and this permission notice shall be |
| 13 | # included in all copies or substantial portions of the Software. |
| 14 | # |
| 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | # IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY |
| 19 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | # |
| 23 | # If you use this package in a product, an acknowledgment in the product |
| 24 | # documentation would be greatly appreciated (but it is not required). |
| 25 | |
| 26 | #CC = gcc |
| 27 | #RM = rm |
| 28 | |
| 29 | # Gives a nice speedup, but also spoils debugging on x86. Comment out this |
| 30 | # line when debugging. |
| 31 | OMIT_FRAME_PTR = -fomit-frame-pointer |
| 32 | |
| 33 | LUABIN = lua |
| 34 | LUAPKG = lua5.2 |
| 35 | CFLAGS = `pkg-config $(LUAPKG) --cflags` -fPIC -O3 -Wall $(OMIT_FRAME_PTR) |
| 36 | LFLAGS = -shared |
| 37 | |
| 38 | INSTALL_PATH = `$(LUABIN) -e' \ |
| 39 | for dir in package.cpath:gmatch("(/[^?;]+)?") do \ |
| 40 | io.write(dir) \ |
| 41 | os.exit(0) \ |
| 42 | end \ |
| 43 | os.exit(1) \ |
| 44 | '` |
| 45 | |
| 46 | ## If your system doesn't have pkg-config or if you do not want to get the |
| 47 | ## install path from Lua, comment out the previous lines and uncomment and |
| 48 | ## change the following ones according to your building environment. |
| 49 | |
| 50 | #CFLAGS = -I/usr/local/include/ -fPIC -O3 -Wall $(OMIT_FRAME_PTR) |
| 51 | #LFLAGS = -shared |
| 52 | #INSTALL_PATH = /usr/local/lib/lua/5.2/ |
| 53 | |
| 54 | |
| 55 | all: iconv.so |
| 56 | |
| 57 | iconv.lo: luaiconv.c |
| 58 | $(CC) -o iconv.lo -c $(CFLAGS) luaiconv.c |
| 59 | |
| 60 | iconv.so: iconv.lo |
| 61 | $(CC) -o iconv.so $(LFLAGS) $(LIBS) iconv.lo |
| 62 | |
| 63 | install: iconv.so |
| 64 | make test |
| 65 | install -D -s iconv.so $(DESTDIR)/$(INSTALL_PATH)/iconv.so |
| 66 | |
| 67 | clean: |
| 68 | $(RM) iconv.so iconv.lo |
| 69 | |
| 70 | test: iconv.so test_iconv.lua |
| 71 | lua test_iconv.lua |
| 72 |