Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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-2015 Gordon Henderson
  8. #################################################################################
  9. # This file is part of wiringPi:
  10. # Wiring Compatable 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. #DEBUG = -g -O0
  28. DEBUG = -O2
  29. CC = gcc
  30. INCLUDE = -I$(DESTDIR)$(PREFIX)/include
  31. CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
  32. LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
  33. LIBS = -lwiringPi -lwiringPiDev -lpthread -lm
  34. # May not need to alter anything below this line
  35. ###############################################################################
  36. SRC = gpio.c readall.c pins.c
  37. OBJ = $(SRC:.c=.o)
  38. all: gpio
  39. gpio: $(OBJ)
  40. @echo [Link]
  41. @$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
  42. .c.o:
  43. @echo [Compile] $<
  44. @$(CC) -c $(CFLAGS) $< -o $@
  45. .PHONY: clean
  46. clean:
  47. @echo "[Clean]"
  48. @rm -f $(OBJ) gpio *~ core tags *.bak
  49. .PHONY: tags
  50. tags: $(SRC)
  51. @echo [ctags]
  52. @ctags $(SRC)
  53. .PHONY: install
  54. install:
  55. @echo "[Install]"
  56. @cp gpio $(DESTDIR)$(PREFIX)/bin
  57. @chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
  58. @chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
  59. @mkdir -p $(DESTDIR)$(PREFIX)/man/man1
  60. @cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1
  61. .PHONY: uninstall
  62. uninstall:
  63. @echo "[UnInstall]"
  64. @rm -f $(DESTDIR)$(PREFIX)/bin/gpio
  65. @rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
  66. .PHONY: depend
  67. depend:
  68. makedepend -Y $(SRC)
  69. # DO NOT DELETE