Advertisement
Guest User

Untitled

a guest
Aug 29th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. INCDIR = include
  2. SRCDIR = src
  3. LIBDIR = lib
  4. BINDIR = bin
  5. CFLAGS = -I/gnu/store/rq2yb7hahsr7npipgx9lzxl6g81qxgbg-sdl2-image-2.0.5/include/SDL2 -I$(INCDIR) $(SDL2_CFLAGS) -std=gnu++17 -fPIC -O3
  6. LDFLAGS = $(SDL2_LDFLAGS) -shared
  7. LIBNAME = libpyxelcore
  8.  
  9. SRCS = $(shell find $(SRCDIR) -type f -name '*.cc')
  10. OBJS = $(SRCS:.cc=.o)
  11.  
  12. ifeq ($(PF),)
  13. ifeq ($(shell uname),Darwin)
  14. PF = macos
  15. endif
  16. ifeq ($(shell uname),Linux)
  17. PF = linux
  18. endif
  19. ifneq ($(findstring MINGW32,$(shell uname)),)
  20. PF = win32
  21. endif
  22. ifneq ($(findstring MINGW64,$(shell uname)),)
  23. PF = win64
  24. endif
  25. endif
  26.  
  27. ifeq ($(PF),macos)
  28. CC = g++-10
  29. SDL2_CFLAGS = `sdl2-config --cflags`
  30. SDL2_LDFLAGS = `sdl2-config --libs` -lSDL2_image
  31. TARGET = $(BINDIR)/macos/$(LIBNAME).dylib
  32. endif
  33.  
  34. ifeq ($(PF),win32)
  35. CC = i686-w64-mingw32-g++
  36. SDL2_CFLAGS = -I$(INCDIR)/win32/SDL2 -Dmain=SDL_main -DPYXEL_DLL
  37. SDL2_LDFLAGS = -static -lstdc++ -lgcc -lwinpthread -L$(LIBDIR)/win32 -Wl,-Bdynamic -lSDL2main -lSDL2 -lSDL2_image -mwindows
  38. TARGET = $(BINDIR)/win32/$(LIBNAME).dll
  39. endif
  40.  
  41. ifeq ($(PF),win64)
  42. CC = x86_64-w64-mingw32-g++
  43. SDL2_CFLAGS = -I$(INCDIR)/win64/SDL2 -Dmain=SDL_main -DPYXEL_DLL
  44. SDL2_LDFLAGS = -static -lstdc++ -lgcc -lwinpthread -L$(LIBDIR)/win64 -Wl,-Bdynamic -lSDL2main -lSDL2 -lSDL2_image -mwindows
  45. TARGET = $(BINDIR)/win64/$(LIBNAME).dll
  46. endif
  47.  
  48. ifeq ($(PF),linux)
  49. CC = g++
  50. SDL2_CFLAGS = `sdl2-config --cflags`
  51. SDL2_LDFLAGS = `sdl2-config --libs` -lSDL2_image -static-libgcc -static-libstdc++
  52. TARGET = $(BINDIR)/linux/$(LIBNAME).so
  53. endif
  54.  
  55. .PHONY: all format clean distclean test
  56.  
  57. all: $(TARGET)
  58.  
  59. format:
  60. find include/pyxelcore.h include/pyxelcore src -name "*.h" -or -name "*.cc" | xargs clang-format -i
  61. isort ../..
  62. black ../..
  63.  
  64. clean:
  65. rm -rf $(OBJS) $(TARGET)
  66.  
  67. distclean:
  68. rm -rf $(OBJS) *.dylib *.dll *.so include/SDL2 lib bin
  69.  
  70. test:
  71. python3 ../examples/01_hello_pyxel.py
  72. python3 ../examples/02_jump_game.py
  73. python3 ../examples/03_draw_api.py
  74. python3 ../examples/04_sound_api.py
  75. python3 ../examples/05_color_palette.py
  76. python3 ../examples/06_click_game.py
  77. python3 ../examples/07_snake.py
  78. python3 ../examples/08_triangle_api.py
  79. python3 ../examples/09_shooter.py
  80. python3 ../editor/__init__.py
  81.  
  82. $(TARGET): $(OBJS)
  83. mkdir -p $(shell dirname $(TARGET))
  84. $(CC) -o $@ $^ $(LDFLAGS)
  85.  
  86. .cc.o:
  87. $(CC) -c $< -o $@ $(CFLAGS)
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement