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 3.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. GCC_ARCH := $(shell gcc -dumpmachine)
  32. ifeq ($(OS),Windows_NT)
  33. CROSS_COMPILE ?= arm-linux-gnueabihf-
  34. else
  35. ifneq ($(GCC_ARCH),arm-linux-gnueabihf)
  36. CROSS_COMPILE ?= arm-linux-gnueabihf-
  37. endif
  38. endif
  39. CC = $(CROSS_COMPILE)gcc
  40. INCLUDE = -I$(DESTDIR)$(PREFIX)/include
  41. CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
  42. LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
  43. LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
  44. # May not need to alter anything below this line
  45. ###############################################################################
  46. SRC = wiringpid.c network.c runRemote.c daemonise.c
  47. OBJ = $(SRC:.c=.o)
  48. all: wiringpid
  49. wiringpid: $(OBJ)
  50. $Q echo [Link]
  51. $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
  52. .c.o:
  53. $Q echo [Compile] $<
  54. $Q $(CC) -c $(CFLAGS) $< -o $@
  55. .PHONY: clean
  56. clean:
  57. $Q echo "[Clean]"
  58. $Q rm -f $(OBJ) wiringpid *~ core tags *.bak
  59. .PHONY: tags
  60. tags: $(SRC)
  61. $Q echo [ctags]
  62. $Q ctags $(SRC)
  63. .PHONY: install
  64. install: wiringpid
  65. $Q echo "[Install]"
  66. $Q mkdir -p $(DESTDIR)$(PREFIX)/sbin
  67. $Q cp wiringpid $(DESTDIR)$(PREFIX)/sbin
  68. $Q chown root.root $(DESTDIR)$(PREFIX)/sbin/wiringpid
  69. # $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man8
  70. # $Q cp gpio.1 $(DESTDIR)$(PREFIX)/man/man8
  71. .PHONY: install-deb
  72. install-deb: gpio
  73. $Q echo "[Install: deb]"
  74. $Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/bin
  75. $Q install -m 0755 gpio ~/wiringPi/debian-template/wiringPi/usr/bin
  76. $Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/man/man1
  77. $Q install -m 0644 gpio.1 ~/wiringPi/debian-template/wiringPi/man/man1
  78. .PHONY: uninstall
  79. uninstall:
  80. $Q echo "[UnInstall]"
  81. $Q rm -f $(DESTDIR)$(PREFIX)/sbin/wiringpid
  82. $Q rm -f $(DESTDIR)$(PREFIX)/man/man8/wiringpid.8
  83. .PHONY: depend
  84. depend:
  85. makedepend -Y $(SRC)
  86. # DO NOT DELETE
  87. wiringpid.o: drcNetCmd.h network.h runRemote.h daemonise.h
  88. network.o: network.h
  89. runRemote.o: drcNetCmd.h network.h runRemote.h
  90. daemonise.o: daemonise.h