Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. CFLAGS=-Wall -O3 -g -Wextra -Wno-unused-parameter
  2. CXXFLAGS=$(CFLAGS)
  3. OBJECTS=d_clock.o
  4. BINARIES=d_clock
  5. # Where our library resides. You mostly only need to change the
  6. # RGB_LIB_DISTRIBUTION, this is where the library is checked out.
  7. RGB_LIB_DISTRIBUTION=/home/pi/projects/rpi-rgb-led-matrix
  8. RGB_INCDIR=$(RGB_LIB_DISTRIBUTION)/include
  9. RGB_LIBDIR=$(RGB_LIB_DISTRIBUTION)/lib
  10. RGB_LIBRARY_NAME=rgbmatrix
  11. RGB_LIBRARY=$(RGB_LIBDIR)/lib$(RGB_LIBRARY_NAME).a
  12. LDFLAGS+=-L$(RGB_LIBDIR) -l$(RGB_LIBRARY_NAME) -lrt -lm -lpthread
  13. all : $(BINARIES)
  14. $(RGB_LIBRARY): FORCE
  15. $(MAKE) -C $(RGB_LIBDIR)
  16. demo : demo-main.o $(RGB_LIBRARY)
  17. $(CXX) $< -o $@ $(LDFLAGS)
  18. d_clock : d_clock.o
  19. # All the binaries that have the same name as the object file.q
  20. % : %.o $(RGB_LIBRARY)
  21. $(CXX) $< -o $@ $(LDFLAGS)
  22. # Since the C example uses the C++ library underneath, which depends on C++
  23. # runtime stuff, you still have to also link -lstdc++
  24. #c-example : c-example.o $(RGB_LIBRARY)
  25. #$(CC) $< -o $@ $(LDFLAGS) -lstdc++
  26. %.o : %.cc
  27. $(CXX) -I$(RGB_INCDIR) $(CXXFLAGS) -c -o $@ $<
  28. %.o : %.c
  29. $(CC) -I$(RGB_INCDIR) $(CFLAGS) -c -o $@ $<
  30. clean:
  31. rm -f $(OBJECTS) $(BINARIES)
  32. FORCE:
  33. .PHONY: FORCE