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.
 
 
 
 
 

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