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.
 
 
 
 
 

110 line
2.8 KiB

  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-2016 Gordon Henderson
  8. #################################################################################
  9. # This file is part of wiringPi:
  10. # A "wiring" 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 -Wextra $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)
  35. LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
  36. LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
  37. # May not need to alter anything below this line
  38. ###############################################################################
  39. SRC = gpio.c readall.c
  40. OBJ = $(SRC:.c=.o)
  41. all: gpio
  42. version.h: ../VERSION
  43. $Q echo Need to run newVersion above.
  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. ifneq ($(WIRINGPI_SUID),0)
  63. $Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
  64. $Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
  65. endif
  66. $Q mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
  67. $Q cp gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1
  68. .PHONY: check-deb-destdir
  69. check-deb-destdir:
  70. ifndef DEB_DESTDIR
  71. $(error DEB_DESTDIR is undefined)
  72. endif
  73. .PHONY: install-deb
  74. install-deb: gpio check-deb-destdir
  75. $Q echo "[Install: deb]"
  76. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/bin
  77. $Q install -m 0755 gpio $(DEB_DESTDIR)/usr/bin
  78. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/share/man/man1
  79. $Q install -m 0644 gpio.1 $(DEB_DESTDIR)/usr/share/man/man1
  80. .PHONY: uninstall
  81. uninstall:
  82. $Q echo "[UnInstall]"
  83. $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
  84. $Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
  85. .PHONY: depend
  86. depend:
  87. makedepend -Y $(SRC)
  88. # DO NOT DELETE
  89. gpio.o: ../version.h