Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #
  2. # Makefile:
  3. # The gpio command:
  4. # A swiss-army knige of GPIO shenanigans.
  5. # https://projects.drogon.net/wiring-pi
  6. #
  7. # Copyright (c) 2012-2015 Gordon Henderson
  8. #################################################################################
  9. # This file is part of wiringPi:
  10. # Wiring Compatable library for the Raspberry Pi
  11. #
  12. # wiringPi is free software: you can redistribute it and/or modify
  13. # it under the terms of the GNU Lesser General Public License as published by
  14. # the Free Software Foundation, either version 3 of the License, or
  15. # (at your option) any later version.
  16. #
  17. # wiringPi is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. # GNU Lesser General Public License for more details.
  21. #
  22. # You should have received a copy of the GNU Lesser General Public License
  23. # along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  24. #################################################################################
  25. DESTDIR=/usr
  26. PREFIX=/local
  27. ifneq ($V,1)
  28. Q ?= @
  29. endif
  30. #DEBUG = -g -O0
  31. DEBUG = -O2
  32. CC = gcc
  33. INCLUDE = -I$(DESTDIR)$(PREFIX)/include
  34. CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
  35. LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
  36. LIBS = -lwiringPi -lwiringPiDev -lpthread -lm
  37. # May not need to alter anything below this line
  38. ###############################################################################
  39. SRC = gpio.c readall.c pins.c
  40. OBJ = $(SRC:.c=.o)
  41. all: gpio
  42. version.h: ../VERSION
  43. ./newVersion
  44. gpio: $(OBJ)
  45. $Q echo [Link]
  46. $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
  47. .c.o:
  48. $Q echo [Compile] $<
  49. $Q $(CC) -c $(CFLAGS) $< -o $@
  50. .PHONY: clean
  51. clean:
  52. $Q echo "[Clean]"
  53. $Q rm -f $(OBJ) gpio *~ core tags *.bak
  54. .PHONY: tags
  55. tags: $(SRC)
  56. $Q echo [ctags]
  57. $Q ctags $(SRC)
  58. .PHONY: install
  59. install: gpio
  60. $Q echo "[Install]"
  61. $Q cp gpio $(DESTDIR)$(PREFIX)/bin
  62. $Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
  63. $Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
  64. $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man1
  65. $Q cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1
  66. .PHONY: install-deb
  67. install-deb: gpio
  68. $Q echo "[Install: deb]"
  69. $Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/bin
  70. $Q install -m 0755 gpio ~/wiringPi/debian-template/wiringPi/usr/bin
  71. .PHONY: uninstall
  72. uninstall:
  73. $Q echo "[UnInstall]"
  74. $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
  75. $Q rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
  76. .PHONY: depend
  77. depend:
  78. makedepend -Y $(SRC)
  79. # DO NOT DELETE