A token parser made with LOVE in mind, loadable via FFI.
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.

61 lines
1.4KB

  1. CC=
  2. LD=
  3. MKDIR=mkdir -p
  4. RM=rm
  5. PCFLAGS=
  6. PLFLAGS=
  7. LIBNAME=
  8. OUTDIR=bin
  9. SRCDIR=src
  10. LFLAGS=
  11. CFLAGS=
  12. RMEXTRA=
  13. GDCCBUILD=OFF
  14. EXAMPLEO=
  15. EXAMPLEC=
  16. ifeq ($(GDCCBUILD),ON)
  17. CC+=gdcc-cc
  18. LD+=gdcc-ld
  19. LIBNAME+=$(OUTDIR)/LoveToken.bin
  20. PCFLAGS+=--bc-target=ZDoom -i$(SRCDIR)
  21. LFLAGS+=--bc-target=ZDoom
  22. EXAMPLEC+=examples/gdcc.c
  23. # These are completely arbitrary.
  24. EXAMPLEO+=$(OUTDIR)/libc.ir $(OUTDIR)/libGDCC.ir $(OUTDIR)/libGDCC-c.ir $(OUTDIR)/libGDCC-ZDACS-asm.ir
  25. else
  26. EXAMPLEC+=examples/main.c
  27. PCFLAGS+=--std=c99 -g -ggdb -O2 -Wall -c -I$(SRCDIR)
  28. ifeq ($(OS),Windows_NT)
  29. CC+=mingw32-gcc
  30. LD+=mingw32-gcc
  31. PLFLAGS+=-shared -g -ggdb
  32. PLFLAGS2+=-Wl,--out-implib,$(OUTDIR)/libLoveToken.a -liconv
  33. LIBNAME+=$(OUTDIR)/LoveToken.dll
  34. RMEXTRA+=$(OUTDIR)/libLoveToken.a
  35. else
  36. ifeq ($(shell uname -s), Linux)
  37. CC+=gcc
  38. LD+=gcc
  39. PCFLAGS+=-fPIC
  40. PLFLAGS2+=-liconv
  41. LIBNAME+=$(OUTDIR)/LoveToken.so
  42. endif
  43. endif
  44. endif
  45. all: $(OUTDIR)
  46. $(CC) $(CFLAGS) $(PCFLAGS) -o $(OUTDIR)/lt.o $(SRCDIR)/lt.c
  47. $(LD) $(LFLAGS) $(PLFLAGS) -o $(LIBNAME) $(OUTDIR)/lt.o $(PLFLAGS2)
  48. $(OUTDIR):
  49. $(MKDIR) $(OUTDIR)
  50. clean:
  51. $(RM) $(LIBNAME) $(OUTDIR)/lt.o $(RMEXTRA)
  52. example: all
  53. $(CC) $(CFLAGS) $(PCFLAGS) -o $(OUTDIR)/example.o $(EXAMPLEC)
  54. $(LD) $(LFLAGS) -o $(OUTDIR)/example $(OUTDIR)/example.o $(EXAMPLEO) $(OUTDIR)/lt.o $(PLFLAGS2)