Makefile (942B)
1 PREFIX = /usr/local 2 DESTDIR = 3 4 LUA_INTERP != ./find_lua 5 6 LUA_CFLAGS != pkg-config --cflags $(LUA_INTERP) 7 LUA_LDFLAGS != pkg-config --libs $(LUA_INTERP) 8 LUA_CMOD_INST != pkg-config --variable=INSTALL_CMOD $(LUA_INTERP) 9 10 CFLAGS = -Wall -Wextra -pedantic $(LUA_CFLAGS) -std=c99 11 LDFLAGS = $(LUA_LDFLAGS) 12 CC = clang 13 14 all: tyarn tyarn.so 15 16 tyarn: tyarn.lua.in 17 sed 's|##LUA_INTERP##|$(LUA_INTERP)|' tyarn.lua.in > $@ 18 19 tyarn.so: tyarn.o strlcpy.o 20 $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ tyarn.o strlcpy.o 21 22 tyarn.o: tyarn.c 23 $(CC) -c -fPIC $(CFLAGS) -o $@ tyarn.c 24 25 install: all 26 install -D -m 755 tyarn $(DESTDIR)$(PREFIX)/bin/tyarn 27 install -D -m 644 tyarn.so $(DESTDIR)$(LUA_CMOD_INST)/tyarn.so 28 install -d $(DESTDIR)$(PREFIX)/man/man1/ 29 install *.1 $(DESTDIR)$(PREFIX)/man/man1/ 30 31 uninstall: all 32 rm -f $(DESTDIR)$(PREFIX)/bin/tyarn 33 rm -f $(DESTDIR)$(LUA_CMOD_INST)/tyarn.so 34 35 clean: 36 rm -f tyarn *.o tyarn.so 37 38 .PHONY: uninstall install clean all