Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # ;
  2. # Makefile:
  3. # wiringPi - Wiring Compatable library for the Raspberry Pi
  4. #
  5. # Copyright (c) 2012 Gordon Henderson
  6. #################################################################################
  7. # This file is part of wiringPi:
  8. # https://projects.drogon.net/raspberry-pi/wiringpi/
  9. #
  10. # wiringPi is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU Lesser General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # wiringPi is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU Lesser General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU Lesser General Public License
  21. # along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  22. #################################################################################
  23. DYN_VERS_MAJ=1
  24. DYN_VERS_MIN=0
  25. VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
  26. DESTDIR=/usr
  27. PREFIX=/local
  28. STATIC=libwiringPi.a
  29. DYNAMIC=libwiringPi.so.$(VERSION)
  30. #DEBUG = -g -O0
  31. DEBUG = -O2
  32. CC = gcc
  33. INCLUDE = -I.
  34. CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
  35. LIBS =
  36. # Should not alter anything below this line
  37. ###############################################################################
  38. SRC = wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c \
  39. gertboard.c \
  40. piNes.c \
  41. lcd.c piHiPri.c piThread.c \
  42. wiringPiSPI.c wiringPiI2C.c \
  43. softPwm.c softServo.c softTone.c
  44. OBJ = $(SRC:.c=.o)
  45. all: $(DYNAMIC)
  46. static: $(STATIC)
  47. $(STATIC): $(OBJ)
  48. @echo "[Link (Static)]"
  49. @ar rcs $(STATIC) $(OBJ)
  50. @ranlib $(STATIC)
  51. # @size $(STATIC)
  52. $(DYNAMIC): $(OBJ)
  53. @echo "[Link (Dynamic)]"
  54. @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
  55. .c.o:
  56. @echo [Compile] $<
  57. @$(CC) -c $(CFLAGS) $< -o $@
  58. .PHONEY: clean
  59. clean:
  60. rm -f $(OBJ) *~ core tags Makefile.bak libwiringPi.*
  61. .PHONEY: tags
  62. tags: $(SRC)
  63. @echo [ctags]
  64. @ctags $(SRC)
  65. .PHONEY: install
  66. install: $(DYNAMIC)
  67. @echo "[Install]"
  68. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  69. @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  70. @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
  71. @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
  72. @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
  73. @install -m 0644 gertboard.h $(DESTDIR)$(PREFIX)/include
  74. @install -m 0644 piNes.h $(DESTDIR)$(PREFIX)/include
  75. @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
  76. @install -m 0644 softServo.h $(DESTDIR)$(PREFIX)/include
  77. @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
  78. @install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
  79. @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
  80. @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
  81. @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
  82. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  83. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
  84. @ldconfig
  85. .PHONEY: install-static
  86. install-static: $(STATIC)
  87. @echo "[Install Static]"
  88. @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
  89. .PHONEY: uninstall
  90. uninstall:
  91. @echo "[UnInstall]"
  92. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
  93. @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
  94. @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
  95. @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
  96. @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
  97. @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
  98. @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
  99. @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
  100. @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
  101. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
  102. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
  103. @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
  104. @ldconfig
  105. .PHONEY: depend
  106. depend:
  107. makedepend -Y $(SRC)
  108. # DO NOT DELETE
  109. wiringPi.o: wiringPi.h
  110. wiringPiFace.o: wiringPi.h
  111. wiringSerial.o: wiringSerial.h
  112. wiringShift.o: wiringPi.h wiringShift.h
  113. gertboard.o: wiringPiSPI.h gertboard.h
  114. piNes.o: wiringPi.h piNes.h
  115. lcd.o: wiringPi.h lcd.h
  116. piHiPri.o: wiringPi.h
  117. piThread.o: wiringPi.h
  118. softPwm.o: wiringPi.h softPwm.h
  119. wiringPiSPI.o: wiringPiSPI.h