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.
 
 
 

85 lines
2.5 KiB

  1. BUILDROOT_PATH := /home/jim/temp/buildroot-2018.11.1/output
  2. HOST_CC := gcc
  3. TARGET_CC := $(BUILDROOT_PATH)/host/bin/arm-buildroot-linux-musleabi-gcc
  4. CFLAGS := -std=c11 -pedantic -D_GNU_SOURCE -D_POSIX_SOURCE -Wno-unused-value -Wno-unknown-pragmas -Wall
  5. DEBUG_FLAGS := -DDEBUG -g
  6. RELEASE_FLAGS := -O2
  7. FBG_DIR := modules/fbg/src
  8. INC_DIR = /usr/include
  9. INC_HEADERS = -I. -I $(FBG_DIR) -I $(INC_DIR)/freetype2 -I $(INC_DIR)
  10. OUTPUT_DIR = bin/$(ARCH)
  11. FBG_LIB := $(FBG_DIR)/lodepng/lodepng.o \
  12. $(FBG_DIR)/nanojpeg/nanojpeg.o \
  13. $(FBG_DIR)/fbgraphics.o
  14. LIBS = $(FBG_LIB) fonts.o fonts_border_renderer.o calendar.o fbg_utils.o image.o timer.o utils.o backlight.o
  15. INCS = $(INC_HEADERS) `pkg-config --libs freetype2` `pkg-config --libs libjpeg` -lonion
  16. FBG_GLFW_DIR := modules/fbg/custom_backend
  17. FBG_GLFW_LIB := $(FBG_GLFW_DIR)/glfw/fbg_glfw.o
  18. INC_GLFW := -I $(FBG_GLFW_DIR) -lm `pkg-config --static --libs glfw3` `pkg-config --libs glu` `pkg-config --libs glew`
  19. GLFW_FLAGS := -DGLFW
  20. RESOLUTION := -DSCREEN_WIDTH=1024 -DSCREEN_HEIGHT=600 -DBACKLIGHT_DEVICE=\"amdgpu_bl0\"
  21. ifeq ($(ARCH), arm)
  22. CC := $(TARGET_CC)
  23. RESOLUTION := -DSCREEN_WIDTH=1024 -DSCREEN_HEIGHT=600 -DBACKLIGHT_DEVICE=\"backlight\"
  24. CFLAGS := $(CFLAGS) -I arm $(RESOLUTION)
  25. INC_DIR := $(BUILDROOT_PATH)/staging/usr/include
  26. else
  27. ARCH := x86_64
  28. CC := $(HOST_CC)
  29. INCS := $(INCS) $(INC_GLFW)
  30. CFLAGS := $(CFLAGS) $(GLFW_FLAGS) $(RESOLUTION) -DONION_PORT=\"8080\"
  31. FBG_LIB := $(FBG_LIB) $(FBG_GLFW_LIB)
  32. endif
  33. ifeq ($(TARGET), debug)
  34. OUTPUT_DIR := $(OUTPUT_DIR)/debug
  35. CFLAGS := $(CFLAGS) $(DEBUG_FLAGS)
  36. else
  37. TARGET := release
  38. OUTPUT_DIR := $(OUTPUT_DIR)/release
  39. CFLAGS := $(CFLAGS) $(RELEASE_FLAGS)
  40. endif
  41. main: $(LIBS)
  42. mkdir -p $(OUTPUT_DIR)
  43. $(CC) $(LIBS) main.c $(INCS) $(CFLAGS) -o $(OUTPUT_DIR)/main
  44. $(FBG_GLFW_DIR)/glfw/fbg_glfw.o : $(FBG_DIR)/fbgraphics.h
  45. $(CC) -c $(FBG_GLFW_DIR)/glfw/fbg_glfw.c -I $(FBG_DIR) $(CFLAGS) -o $(FBG_GLFW_DIR)/glfw/fbg_glfw.o
  46. fonts.o: fonts.c fonts_border_renderer.o
  47. $(CC) -c fonts.c $(INC_HEADERS) $(CFLAGS)
  48. fonts_border_renderer.o: fonts_border_renderer.c
  49. $(CC) -c fonts_border_renderer.c $(INC_HEADERS) $(CFLAGS)
  50. calendar.o : calendar.c
  51. $(CC) -c calendar.c $(INC_HEADERS) $(CFLAGS)
  52. fbg_utils.o : fbg_utils.c
  53. $(CC) -c fbg_utils.c $(INC_HEADERS) $(CFLAGS)
  54. timer.o: timer.c
  55. $(CC) -c timer.c $(CFLAGS)
  56. image.o : image.c
  57. $(CC) -c image.c $(INC_HEADERS) $(CFLAGS)
  58. utils.o : utils.c
  59. $(CC) -c utils.c $(INC_HEADERS) $(CFLAGS)
  60. backlight.o : backlight.c
  61. $(CC) -c backlight.c $(INC_HEADERS) $(CFLAGS)
  62. .PHONY : clean
  63. clean :
  64. rm -f $(LIBS) $(OUTPUT_DIR)/main