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.
 
 
 
 
 

187 lines
6.0 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://github.com/wiringPi/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. LIBDIR=$(DESTDIR)$(PREFIX)/lib
  27. INCLUDEDIR=$(DESTDIR)$(PREFIX)/include
  28. PKGCONFIGDIR = /usr/share/pkgconfig
  29. LDCONFIG?=ldconfig
  30. ifneq ($V,1)
  31. Q ?= @
  32. endif
  33. STATIC=libwiringPi.a
  34. DYNAMIC=libwiringPi.so.$(VERSION)
  35. #DEBUG = -g -O0
  36. DEBUG = -O2
  37. CC ?= gcc
  38. INCLUDE = -I.
  39. DEFS = -D_GNU_SOURCE
  40. CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
  41. #CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC
  42. LIBS = -lm -lpthread -lrt -lcrypt
  43. ###############################################################################
  44. SRC = wiringPi.c \
  45. wiringSerial.c wiringShift.c \
  46. piHiPri.c piThread.c \
  47. wiringPiSPI.c wiringPiI2C.c \
  48. softPwm.c softTone.c \
  49. mcp23008.c mcp23016.c mcp23017.c \
  50. mcp23s08.c mcp23s17.c \
  51. sr595.c \
  52. pcf8574.c pcf8591.c \
  53. mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
  54. max31855.c max5322.c ads1115.c \
  55. sn3218.c \
  56. bmp180.c htu21d.c ds18b20.c rht03.c \
  57. drcSerial.c drcNet.c \
  58. pseudoPins.c \
  59. wpiExtensions.c \
  60. wiringPiLegacy.c
  61. HEADERS = $(shell ls *.h)
  62. OBJ = $(SRC:.c=.o)
  63. all: $(DYNAMIC)
  64. .PHONY: static
  65. static:
  66. $Q cat noMoreStatic
  67. $(DYNAMIC): $(OBJ)
  68. $Q echo "[Link (Dynamic)]"
  69. $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS)
  70. .c.o:
  71. $Q echo [Compile] $<
  72. $Q $(CC) -c $(CFLAGS) $< -o $@
  73. .PHONY: clean
  74. clean:
  75. $Q echo "[Clean]"
  76. $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
  77. .PHONY: tags
  78. tags: $(SRC)
  79. $Q echo [ctags]
  80. $Q ctags $(SRC)
  81. wiringPi.pc: wiringPi.pc.in
  82. sed -e 's|@prefix@|$(DESTDIR)$(PREFIX)|g' \
  83. -e 's|@libdir@|$(LIBDIR)|g' \
  84. -e 's|@includedir@|$(INCLUDEDIR)|g' \
  85. -e 's|@VERSION@|$(VERSION)|g' \
  86. $< > $@
  87. .PHONY: install
  88. install: $(DYNAMIC) wiringPi.pc
  89. $Q echo "[Install Headers]"
  90. $Q install -m 0755 -d $(INCLUDEDIR)
  91. $Q install -m 0644 $(HEADERS) $(INCLUDEDIR)
  92. $Q echo "[Install Dynamic Lib]"
  93. $Q install -m 0755 -d $(LIBDIR)
  94. $Q install -m 0755 libwiringPi.so.$(VERSION) $(LIBDIR)/libwiringPi.so.$(VERSION)
  95. $Q ln -sf $(LIBDIR)/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  96. $Q $(LDCONFIG)
  97. $Q echo "[Install pkg-config configuration]"
  98. $Q install -m 0644 wiringPi.pc $(PKGCONFIGDIR)/wiringPi.pc
  99. .PHONY: check-deb-destdir
  100. check-deb-destdir:
  101. ifndef DEB_DESTDIR
  102. $(error DEB_DESTDIR is undefined)
  103. endif
  104. .PHONY: install-deb
  105. install-deb: $(DYNAMIC) check-deb-destdir wiringPi.pc
  106. $Q echo "[Install Headers: deb]"
  107. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
  108. $Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
  109. $Q echo "[Install Dynamic Lib: deb]"
  110. install -m 0755 -d $(DEB_DESTDIR)/usr/lib
  111. install -m 0755 libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION)
  112. ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so
  113. $Q echo "[Install pkg-config configuration: deb]"
  114. $Q install -m 0755 -d $(DEB_DESTDIR)$(PKGCONFIGDIR)
  115. $Q install -m 0644 wiringPi.pc $(DEB_DESTDIR)$(PKGCONFIGDIR)/wiringPi.pc
  116. .PHONY: uninstall
  117. uninstall:
  118. $Q echo "[UnInstall]"
  119. $Q cd $(INCLUDEDIR) && rm -f $(HEADERS)
  120. $Q cd $(LIBDIR) && rm -f libwiringPi.*
  121. $Q cd $(PKGCONFIGDIR) && rm -f wiringPi.pc
  122. $Q $(LDCONFIG)
  123. .PHONY: depend
  124. depend:
  125. makedepend -Y $(SRC) $(SRC_I2C)
  126. # DO NOT DELETE
  127. wiringPi.o: softPwm.h softTone.h wiringPi.h ../version.h
  128. wiringSerial.o: wiringSerial.h
  129. wiringShift.o: wiringPi.h wiringShift.h
  130. piHiPri.o: wiringPi.h
  131. piThread.o: wiringPi.h
  132. wiringPiSPI.o: wiringPi.h wiringPiSPI.h
  133. wiringPiI2C.o: wiringPi.h wiringPiI2C.h
  134. softPwm.o: wiringPi.h softPwm.h
  135. softTone.o: wiringPi.h softTone.h
  136. mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
  137. mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
  138. mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
  139. mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
  140. mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
  141. sr595.o: wiringPi.h sr595.h
  142. pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
  143. pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
  144. mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
  145. mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
  146. mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
  147. mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
  148. max31855.o: wiringPi.h wiringPiSPI.h max31855.h
  149. max5322.o: wiringPi.h wiringPiSPI.h max5322.h
  150. ads1115.o: wiringPi.h wiringPiI2C.h ads1115.h
  151. sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
  152. bmp180.o: wiringPi.h wiringPiI2C.h bmp180.h
  153. htu21d.o: wiringPi.h wiringPiI2C.h htu21d.h
  154. ds18b20.o: wiringPi.h ds18b20.h
  155. drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
  156. pseudoPins.o: wiringPi.h pseudoPins.h
  157. wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
  158. wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
  159. wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h ads1115.h sn3218.h
  160. wpiExtensions.o: drcSerial.h pseudoPins.h bmp180.h htu21d.h ds18b20.h
  161. wpiExtensions.o: wpiExtensions.h