Makefile 2.7 KB

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