Makefile 514 B

1234567891011121314151617181920212223242526272829303132
  1. INC = -I.
  2. ifdef LUAPATH
  3. INC += -I$(LUAPATH)
  4. endif
  5. UNAME_S := $(shell uname -s)
  6. ifeq ($(UNAME_S), Darwin)
  7. INC += -I/usr/local/include
  8. NEWT_LIB = -L/usr/local/lib -lnewt
  9. SHARED_LIB = -dynamiclib -Wl,-undefined,dynamic_lookup
  10. else
  11. NEWT_LIB = -lnewt
  12. SHARED_LIB = -shared
  13. endif
  14. CFLAGS = -fPIC -O3 -Wall -std=c99 -pedantic
  15. CFLAGS += $(INC)
  16. NEWT_SO = newt.so
  17. all: $(NEWT_SO)
  18. $(NEWT_SO): ./luanewt.c ./luanewt.h
  19. $(CC) $(SHARED_LIB) -o $@ $(CFLAGS) $< $(NEWT_LIB)
  20. clean:
  21. $(RM) $(NEWT_SO)
  22. .PHONY: all clean