Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Makefile 2.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. DEBTEMPDIR?=~/WiringPi
  28. ifneq ($V,1)
  29. Q ?= @
  30. endif
  31. #DEBUG = -g -O0
  32. DEBUG = -O2
  33. CC = gcc
  34. INCLUDE = -I$(DESTDIR)$(PREFIX)/include
  35. CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
  36. LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
  37. LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
  38. # May not need to alter anything below this line
  39. ###############################################################################
  40. SRC = gpio.c readall.c
  41. OBJ = $(SRC:.c=.o)
  42. all: gpio
  43. version.h: ../VERSION
  44. $Q echo Need to run newVersion above.
  45. gpio: $(OBJ)
  46. $Q echo [Link]
  47. $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
  48. .c.o:
  49. $Q echo [Compile] $<
  50. $Q $(CC) -c $(CFLAGS) $< -o $@
  51. .PHONY: clean
  52. clean:
  53. $Q echo "[Clean]"
  54. $Q rm -f $(OBJ) gpio *~ core tags *.bak
  55. .PHONY: tags
  56. tags: $(SRC)
  57. $Q echo [ctags]
  58. $Q ctags $(SRC)
  59. .PHONY: install
  60. install: gpio
  61. $Q echo "[Install]"
  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: install-deb
  70. install-deb: gpio
  71. $Q echo "[Install: deb]"
  72. $Q install -m 0755 -d $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/bin
  73. $Q install -m 0755 gpio $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/bin
  74. $Q install -m 0755 -d $(DEBTEMPDIR)/debian-template/wiringPi/usr/share/man/man1
  75. $Q install -m 0644 gpio.1 $(DEBTEMPDIR)/debian-template/wiringPi/usr/share/man/man1
  76. .PHONY: uninstall
  77. uninstall:
  78. $Q echo "[UnInstall]"
  79. $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
  80. $Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
  81. .PHONY: depend
  82. depend:
  83. makedepend -Y $(SRC)
  84. # DO NOT DELETE
  85. gpio.o: ../version.h