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.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Makefile:
  3. # The gpio command:
  4. # A swiss-army knige of GPIO shenanigans.
  5. # https://github.com/wiringPi/wiringPi
  6. #
  7. # Copyright (c) 2012-2024 Gordon Henderson and contributors
  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 mkdir -p $(DESTDIR)$(PREFIX)/bin
  62. $Q cp gpio $(DESTDIR)$(PREFIX)/bin
  63. ifneq ($(WIRINGPI_SUID),0)
  64. $Q chown root:root $(DESTDIR)$(PREFIX)/bin/gpio
  65. $Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
  66. endif
  67. $Q mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
  68. $Q cp gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1
  69. .PHONY: check-deb-destdir
  70. check-deb-destdir:
  71. ifndef DEB_DESTDIR
  72. $(error DEB_DESTDIR is undefined)
  73. endif
  74. .PHONY: install-deb
  75. install-deb: gpio check-deb-destdir
  76. $Q echo "[Install: deb]"
  77. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/bin
  78. $Q install -m 0755 gpio $(DEB_DESTDIR)/usr/bin
  79. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/share/man/man1
  80. $Q install -m 0644 gpio.1 $(DEB_DESTDIR)/usr/share/man/man1
  81. .PHONY: uninstall
  82. uninstall:
  83. $Q echo "[UnInstall]"
  84. $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
  85. $Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
  86. .PHONY: depend
  87. depend:
  88. makedepend -Y $(SRC)
  89. # DO NOT DELETE
  90. gpio.o: ../version.h