Makefile 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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=2
  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. DEFS = -D_GNU_SOURCE
  35. CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
  36. LIBS =
  37. # Should not alter anything below this line
  38. ###############################################################################
  39. SRC = wiringPi.c \
  40. wiringSerial.c wiringShift.c \
  41. piHiPri.c piThread.c \
  42. wiringPiSPI.c wiringPiI2C.c \
  43. softPwm.c softTone.c \
  44. mcp23008.c mcp23016.c mcp23017.c \
  45. mcp23s08.c mcp23s17.c \
  46. sr595.c \
  47. pcf8574.c pcf8591.c \
  48. mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
  49. max31855.c max5322.c \
  50. sn3218.c \
  51. drcSerial.c
  52. OBJ = $(SRC:.c=.o)
  53. all: $(DYNAMIC)
  54. static: $(STATIC)
  55. $(STATIC): $(OBJ)
  56. @echo "[Link (Static)]"
  57. @ar rcs $(STATIC) $(OBJ)
  58. @ranlib $(STATIC)
  59. # @size $(STATIC)
  60. $(DYNAMIC): $(OBJ)
  61. @echo "[Link (Dynamic)]"
  62. @$(CC) -shared -Wl,-soname,libwiringPi.so -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
  63. .c.o:
  64. @echo [Compile] $<
  65. @$(CC) -c $(CFLAGS) $< -o $@
  66. .PHONEY: clean
  67. clean:
  68. @echo "[Clean]"
  69. @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
  70. .PHONEY: tags
  71. tags: $(SRC)
  72. @echo [ctags]
  73. @ctags $(SRC)
  74. .PHONEY: install-headers
  75. install-headers:
  76. @echo "[Install Headers]"
  77. @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  78. @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
  79. @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
  80. @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
  81. @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
  82. @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
  83. @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
  84. @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
  85. @install -m 0644 drcSerial.h $(DESTDIR)$(PREFIX)/include
  86. @install -m 0644 mcp23008.h $(DESTDIR)$(PREFIX)/include
  87. @install -m 0644 mcp23016.h $(DESTDIR)$(PREFIX)/include
  88. @install -m 0644 mcp23017.h $(DESTDIR)$(PREFIX)/include
  89. @install -m 0644 mcp23s08.h $(DESTDIR)$(PREFIX)/include
  90. @install -m 0644 mcp23s17.h $(DESTDIR)$(PREFIX)/include
  91. @install -m 0644 max31855.h $(DESTDIR)$(PREFIX)/include
  92. @install -m 0644 max5322.h $(DESTDIR)$(PREFIX)/include
  93. @install -m 0644 mcp3002.h $(DESTDIR)$(PREFIX)/include
  94. @install -m 0644 mcp3004.h $(DESTDIR)$(PREFIX)/include
  95. @install -m 0644 mcp4802.h $(DESTDIR)$(PREFIX)/include
  96. @install -m 0644 mcp3422.h $(DESTDIR)$(PREFIX)/include
  97. @install -m 0644 sr595.h $(DESTDIR)$(PREFIX)/include
  98. @install -m 0644 pcf8574.h $(DESTDIR)$(PREFIX)/include
  99. @install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
  100. @install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
  101. .PHONEY: install
  102. install: $(DYNAMIC) install-headers
  103. @echo "[Install Dynamic Lib]"
  104. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  105. @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
  106. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  107. @ldconfig
  108. .PHONEY: install-static
  109. install-static: $(STATIC) install-headers
  110. @echo "[Install Static Lib]"
  111. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  112. @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
  113. .PHONEY: uninstall
  114. uninstall:
  115. @echo "[UnInstall]"
  116. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
  117. @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
  118. @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
  119. @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
  120. @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
  121. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
  122. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
  123. @rm -f $(DESTDIR)$(PREFIX)/include/drcSerial.h
  124. @rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h
  125. @rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h
  126. @rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h
  127. @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h
  128. @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h
  129. @rm -f $(DESTDIR)$(PREFIX)/include/max31855.h
  130. @rm -f $(DESTDIR)$(PREFIX)/include/max5322.h
  131. @rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h
  132. @rm -f $(DESTDIR)$(PREFIX)/include/mcp3004.h
  133. @rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h
  134. @rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h
  135. @rm -f $(DESTDIR)$(PREFIX)/include/sr595.h
  136. @rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h
  137. @rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h
  138. @rm -f $(DESTDIR)$(PREFIX)/include/sn3218.h
  139. @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
  140. @ldconfig
  141. .PHONEY: depend
  142. depend:
  143. makedepend -Y $(SRC) $(SRC_I2C)
  144. # DO NOT DELETE
  145. wiringPi.o: softPwm.h softTone.h wiringPi.h
  146. wiringSerial.o: wiringSerial.h
  147. wiringShift.o: wiringPi.h wiringShift.h
  148. piHiPri.o: wiringPi.h
  149. piThread.o: wiringPi.h
  150. wiringPiSPI.o: wiringPi.h wiringPiSPI.h
  151. wiringPiI2C.o: wiringPi.h wiringPiI2C.h
  152. softPwm.o: wiringPi.h softPwm.h
  153. softTone.o: wiringPi.h softTone.h
  154. mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
  155. mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
  156. mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
  157. mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
  158. mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
  159. sr595.o: wiringPi.h sr595.h
  160. pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
  161. pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
  162. mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
  163. mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
  164. mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
  165. mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
  166. max31855.o: wiringPi.h wiringPiSPI.h max31855.h
  167. max5322.o: wiringPi.h wiringPiSPI.h max5322.h
  168. sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
  169. drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h