diff --git a/Makefile b/Makefile index 7543877..703edff 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,18 @@ OBJS := $(COBJS) $(CXXOBJS) CDEPS := $(COBJS:.o=.dep) CXXDEPS := $(CXXOBJS:.o=.dep) DEPS := $(CDEPS) $(CXXDEPS) -CPPFLAGS := -I/usr/include/lua5.1 -LDFLAGS := -llua5.1 -lGL -lGLU + +LUAINCLUDE := $(shell which lua-config >/dev/null 2>&1; if [[ $$? == 0 ]]; then lua-config --include; fi) +ifeq ($(LUA_INCLUDE),) +LUA_INCLUDE := -I/usr/include/lua5.1 +endif +LUALIBS := $(shell which lua-config >/dev/null 2>&1; if [[ $$? == 0 ]]; then lua-config --libs; fi) +ifeq ($(LUALIBS),) +LUALIBS := -llua5.1 +endif + +CPPFLAGS := $(LUAINCLUDE) +LDFLAGS := $(LUALIBS) -lGL -lGLU All: $(TARGET)