Mac OS X gamepad emulator for serial RC transmitters
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.

Makefile 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # ----------------------------------------------------------------------------
  2. # "THE BEER-WARE LICENSE" (Revision 42):
  3. # <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  4. # you can do whatever you want with this stuff. If we meet some day, and you
  5. # think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  6. # ----------------------------------------------------------------------------
  7. # C Compiler flags for command line apps
  8. CFLAGS ?= -Wall -pedantic -std=c11
  9. # Targets that don't name any created files
  10. .PHONY: all install distribute clean
  11. # Build all binaries
  12. all: bin/protocol bin/foohid build/Release/SerialGamepad.app
  13. @rm -rf bin/SerialGamepad.app
  14. @cp -R build/Release/SerialGamepad.app bin/SerialGamepad.app
  15. # Install locally
  16. install: bin/protocol bin/foohid build/Release/SerialGamepad.app
  17. cp bin/protocol /usr/local/bin/serial-protocol
  18. cp bin/foohid /usr/local/bin/foohid
  19. @rm -rf /Applications/SerialGamepad.app
  20. cp -r build/Release/SerialGamepad.app /Applications/SerialGamepad.app
  21. # Build GUI project
  22. build/Release/SerialGamepad.app: SerialGamepad SerialGamepad.xcodeproj
  23. xcodebuild
  24. # Build protocol binary
  25. bin/protocol: src/serial.o src/protocol.o
  26. @mkdir -p bin
  27. $(CC) -o bin/protocol src/serial.o src/protocol.o
  28. # Build foohid binary
  29. bin/foohid: src/serial.o src/foohid.o
  30. @mkdir -p bin
  31. $(CC) -o bin/foohid -framework IOKit src/serial.o src/foohid.o
  32. # Build distributable installer package
  33. distribute: build/Installer.pkg
  34. @mkdir -p bin
  35. @rm -rf bin/SerialGamepad.pkg
  36. @cp -R build/Installer.pkg bin/SerialGamepad.pkg
  37. # Download foohid binary dependency
  38. build/foohid.pkg:
  39. @mkdir -p build
  40. curl -o build/foohid.dmg \
  41. -L https://github.com/unbit/foohid/releases/download/0.2.1/foohid-0.2.1.dmg
  42. hdiutil attach build/foohid.dmg
  43. cp /Volumes/foohid/foohid-0.2.1.pkg build/foohid.pkg
  44. umount /Volumes/foohid
  45. # Create installer pkg for our App
  46. build/SerialGamepad.pkg: build/Release/SerialGamepad.app
  47. pkgbuild \
  48. --root build/Release/SerialGamepad.app \
  49. --identifier de.xythobuz.SerialGamepad \
  50. --install-location "/Applications/SerialGamepad.app" \
  51. build/SerialGamepad.pkg
  52. # Create installer bundling our App and fooHID
  53. build/Installer.pkg: build/SerialGamepad.pkg build/foohid.pkg Resources
  54. productbuild \
  55. --distribution Resources/Distribution.xml \
  56. --package-path build \
  57. --resources Resources \
  58. build/Installer.pkg
  59. # Delete intermediate files
  60. clean:
  61. rm -rf bin
  62. rm -rf build
  63. rm -rf src/*.o