Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

177 rader
5.5 KiB

  1. #
  2. # Makefile:
  3. # wiringPi - Wiring Compatable library for the Raspberry Pi
  4. #
  5. # Copyright (c) 2012-2015 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. VERSION=$(shell cat ../VERSION)
  24. DESTDIR=/usr
  25. PREFIX=/local
  26. STATIC=libwiringPi.a
  27. DYNAMIC=libwiringPi.so.$(VERSION)
  28. #DEBUG = -g -O0
  29. DEBUG = -O2
  30. CC = gcc
  31. INCLUDE = -I.
  32. DEFS = -D_GNU_SOURCE
  33. CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
  34. LIBS =
  35. ###############################################################################
  36. SRC = wiringPi.c \
  37. wiringSerial.c wiringShift.c \
  38. piHiPri.c piThread.c \
  39. wiringPiSPI.c wiringPiI2C.c \
  40. softPwm.c softTone.c \
  41. mcp23008.c mcp23016.c mcp23017.c \
  42. mcp23s08.c mcp23s17.c \
  43. sr595.c \
  44. pcf8574.c pcf8591.c \
  45. mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
  46. max31855.c max5322.c \
  47. sn3218.c \
  48. drcSerial.c \
  49. wpiExtensions.c
  50. HEADERS = wiringPi.h \
  51. wiringSerial.h wiringShift.h \
  52. wiringPiSPI.h wiringPiI2C.h \
  53. softPwm.h softTone.h \
  54. mcp23008.h mcp23016.h mcp23017.h \
  55. mcp23s08.h mcp23s17.h \
  56. sr595.h \
  57. pcf8574.h pcf8591.h \
  58. mcp3002.h mcp3004.h mcp4802.h mcp3422.h \
  59. max31855.h max5322.h \
  60. sn3218.h \
  61. drcSerial.h \
  62. wpiExtensions.h
  63. OBJ = $(SRC:.c=.o)
  64. all: $(DYNAMIC)
  65. static: $(STATIC)
  66. $(STATIC): $(OBJ)
  67. @echo "[Link (Static)]"
  68. @ar rcs $(STATIC) $(OBJ)
  69. @ranlib $(STATIC)
  70. # @size $(STATIC)
  71. $(DYNAMIC): $(OBJ)
  72. @echo "[Link (Dynamic)]"
  73. @$(CC) -shared -Wl,-soname,libwiringPi.so -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
  74. .c.o:
  75. @echo [Compile] $<
  76. @$(CC) -c $(CFLAGS) $< -o $@
  77. .PHONY: clean
  78. clean:
  79. @echo "[Clean]"
  80. @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
  81. .PHONY: tags
  82. tags: $(SRC)
  83. @echo [ctags]
  84. @ctags $(SRC)
  85. .PHONY: install
  86. install: $(DYNAMIC)
  87. @echo "[Install Headers]"
  88. @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  89. @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
  90. @echo "[Install Dynamic Lib]"
  91. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  92. @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
  93. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  94. @ldconfig
  95. .PHONY: install-static
  96. install-static: $(STATIC)
  97. @echo "[Install Headers]"
  98. @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  99. @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
  100. @echo "[Install Static Lib]"
  101. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  102. @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
  103. .PHONY: install-deb
  104. install-deb: $(DYNAMIC)
  105. @echo "[Install Headers: deb]"
  106. @install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/include
  107. @install -m 0644 $(HEADERS) ~/wiringPi/debian/wiringPi/usr/include
  108. @echo "[Install Dynamic Lib: deb]"
  109. install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/lib
  110. install -m 0755 libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
  111. ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so
  112. .PHONY: uninstall
  113. uninstall:
  114. @echo "[UnInstall]"
  115. @cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
  116. @cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
  117. @ldconfig
  118. .PHONY: depend
  119. depend:
  120. makedepend -Y $(SRC) $(SRC_I2C)
  121. # DO NOT DELETE
  122. wiringPi.o: softPwm.h softTone.h wiringPi.h
  123. wiringSerial.o: wiringSerial.h
  124. wiringShift.o: wiringPi.h wiringShift.h
  125. piHiPri.o: wiringPi.h
  126. piThread.o: wiringPi.h
  127. wiringPiSPI.o: wiringPi.h wiringPiSPI.h
  128. wiringPiI2C.o: wiringPi.h wiringPiI2C.h
  129. softPwm.o: wiringPi.h softPwm.h
  130. softTone.o: wiringPi.h softTone.h
  131. mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
  132. mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
  133. mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
  134. mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
  135. mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
  136. sr595.o: wiringPi.h sr595.h
  137. pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
  138. pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
  139. mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
  140. mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
  141. mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
  142. mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
  143. max31855.o: wiringPi.h wiringPiSPI.h max31855.h
  144. max5322.o: wiringPi.h wiringPiSPI.h max5322.h
  145. sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
  146. drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
  147. wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
  148. wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
  149. wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h sn3218.h
  150. wpiExtensions.o: drcSerial.h wpiExtensions.h