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.
 
 
 
 
 

174 line
5.7 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. DEBTEMPDIR?=~/WiringPi
  27. LDCONFIG?=ldconfig
  28. ifneq ($V,1)
  29. Q ?= @
  30. endif
  31. STATIC=libwiringPi.a
  32. DYNAMIC=libwiringPi.so.$(VERSION)
  33. #DEBUG = -g -O0
  34. DEBUG = -O2
  35. CC = gcc
  36. INCLUDE = -I.
  37. DEFS = -D_GNU_SOURCE
  38. CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
  39. #CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC
  40. LIBS = -lm -lpthread -lrt -lcrypt
  41. ###############################################################################
  42. SRC = wiringPi.c \
  43. wiringSerial.c wiringShift.c \
  44. piHiPri.c piThread.c \
  45. wiringPiSPI.c wiringPiI2C.c \
  46. softPwm.c softTone.c \
  47. mcp23008.c mcp23016.c mcp23017.c \
  48. mcp23s08.c mcp23s17.c \
  49. sr595.c \
  50. pcf8574.c pcf8591.c \
  51. mcp3002.c mcp3004.c mcp4802.c mcp3422.c \
  52. max31855.c max5322.c ads1115.c \
  53. sn3218.c \
  54. bmp180.c htu21d.c ds18b20.c rht03.c \
  55. drcSerial.c drcNet.c \
  56. pseudoPins.c \
  57. wpiExtensions.c \
  58. khadas_vim1.c \
  59. khadas_vim2.c \
  60. khadas_vim3.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) $(LIBS) $(OBJ)
  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. .PHONY: install
  82. install: $(DYNAMIC)
  83. $Q echo "[Install Headers]"
  84. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  85. $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
  86. $Q echo "[Install Dynamic Lib]"
  87. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  88. $Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
  89. $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  90. $Q $(LDCONFIG)
  91. .PHONY: install-deb
  92. install-deb: $(DYNAMIC)
  93. $Q echo "[Install Headers: deb]"
  94. $Q install -m 0755 -d $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/include
  95. $Q install -m 0644 $(HEADERS) $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/include
  96. $Q echo "[Install Dynamic Lib: deb]"
  97. install -m 0755 -d $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/lib
  98. install -m 0755 libwiringPi.so.$(VERSION) $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/lib/libwiringPi.so.$(VERSION)
  99. cd $(DEBTEMPDIR)/debian-template/wiringPi/usr/local/lib && ln -sf libwiringPi.so.$(VERSION) libwiringPi.so && cd -
  100. .PHONY: uninstall
  101. uninstall:
  102. $Q echo "[UnInstall]"
  103. $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
  104. $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
  105. $Q $(LDCONFIG)
  106. .PHONY: depend
  107. depend:
  108. makedepend -Y $(SRC) $(SRC_I2C)
  109. # DO NOT DELETE
  110. #KHADAS Boards
  111. khadas_vim1.o : wiringPi.h khadas_vim1.h
  112. khadas_vim2.o : wiringPi.h khadas_vim2.h
  113. khadas_vim3.o : wiringPi.h khadas_vim3.h
  114. wiringPi.o: softPwm.h softTone.h wiringPi.h ../version.h
  115. wiringSerial.o: wiringSerial.h
  116. wiringShift.o: wiringPi.h wiringShift.h
  117. piHiPri.o: wiringPi.h
  118. piThread.o: wiringPi.h
  119. wiringPiSPI.o: wiringPi.h wiringPiSPI.h
  120. wiringPiI2C.o: wiringPi.h wiringPiI2C.h
  121. softPwm.o: wiringPi.h softPwm.h
  122. softTone.o: wiringPi.h softTone.h
  123. mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
  124. mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
  125. mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
  126. mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
  127. mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
  128. sr595.o: wiringPi.h sr595.h
  129. pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
  130. pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
  131. mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
  132. mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
  133. mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
  134. mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
  135. max31855.o: wiringPi.h wiringPiSPI.h max31855.h
  136. max5322.o: wiringPi.h wiringPiSPI.h max5322.h
  137. ads1115.o: wiringPi.h wiringPiI2C.h ads1115.h
  138. sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
  139. bmp180.o: wiringPi.h wiringPiI2C.h bmp180.h
  140. htu21d.o: wiringPi.h wiringPiI2C.h htu21d.h
  141. ds18b20.o: wiringPi.h ds18b20.h
  142. drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
  143. pseudoPins.o: wiringPi.h pseudoPins.h
  144. wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
  145. wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
  146. wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h ads1115.h sn3218.h
  147. wpiExtensions.o: drcSerial.h pseudoPins.h bmp180.h htu21d.h ds18b20.h
  148. wpiExtensions.o: wpiExtensions.h