cross platform gui lib for lua
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

73 lines
1.6 KiB

  1. # simple Makefile for lui. Works for Linux.
  2. #
  3. # Gunnar Zötl <gz@tset.de>, 2016-2017
  4. # Released under MIT/X11 license. See file LICENSE for details.
  5. TARGET=lui.so
  6. DEBUG = -g -DDEBUG
  7. # try some automatic discovery
  8. OS = $(shell uname -s)
  9. LUAVERSION = $(shell lua -e "print(string.match(_VERSION, '%d+%.%d+'))")
  10. LUA_BINDIR = $(shell dirname `which lua`)
  11. LUAROOT = $(shell dirname $(LUA_BINDIR))
  12. CC=gcc
  13. CFLAGS = -fPIC -Wall $(DEBUG)
  14. LUA_INCDIR = $(LUAROOT)/include
  15. LUA_LIBDIR = $(LUAROOT)/lib
  16. LUA = lua
  17. # OS specialities
  18. ifeq ($(OS),Darwin)
  19. LIBFLAG = -bundle -undefined dynamic_lookup -all_load -framework Cocoa
  20. LIBUIOBJDIR=darwin
  21. else
  22. LIBFLAG = -shared
  23. LIBS=$(shell pkg-config gtk+-3.0 --libs) -lm -ldl
  24. LIBUIOBJDIR=unix
  25. endif
  26. # install target locations
  27. INST_DIR = /usr/local
  28. INST_LIBDIR = $(INST_DIR)/lib/lua/$(LUAVERSION)
  29. INST_LUADIR = $(INST_DIR)/share/lua/$(LUAVERSION)
  30. # no user servicable parts below
  31. LIBUI=libui
  32. LIBUI_OBJS=$(LIBUI)/CMakeFiles/libui.dir/common/*.o $(LIBUI)/CMakeFiles/libui.dir/$(LIBUIOBJDIR)/*.o
  33. all: $(TARGET)
  34. $(TARGET): lui.o luad.o $(LIBUI_OBJS)
  35. $(CC) $(LIBFLAG) -L$(LUA_LIBDIR) -o $@ $< luad.o $(LIBUI_OBJS) $(LIBS)
  36. lui.o: libui lui.c *.inc.c
  37. .c.o:; $(CC) $(CFLAGS) -I$(LIBUI) -I$(LUA_INCDIR) -c -o $@ $<
  38. $(LIBUI_OBJS): libui
  39. make -C $(LIBUI)
  40. install: all
  41. mkdir -p $(INST_LIBDIR)
  42. cp $(TARGET) $(INST_LIBDIR)
  43. doc:
  44. cat lui.c *.inc.c | lua ./mkdoc "lui Documentation" - > lui.html
  45. .PHONY: doc
  46. clean:
  47. make -C $(LIBUI) clean
  48. rm -f *.o *.so lui.html
  49. distclean: clean
  50. rm -rf libui
  51. libui:
  52. git clone https://github.com/andlabs/libui
  53. cd libui && cmake . && make
  54. update-libui:
  55. cd libui && git pull && cmake . && make