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.
 
 
 
 
 

153 lines
4.6 KiB

  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=1
  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. CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
  35. LIBS =
  36. # Should not alter anything below this line
  37. ###############################################################################
  38. SRC = wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c \
  39. gertboard.c \
  40. piNes.c \
  41. lcd.c piHiPri.c piThread.c \
  42. wiringPiSPI.c \
  43. softPwm.c softServo.c softTone.c
  44. SRC_I2C = wiringPiI2C.c
  45. OBJ = $(SRC:.c=.o)
  46. OBJ_I2C = $(SRC_I2C:.c=.o)
  47. all: $(DYNAMIC)
  48. static: $(STATIC)
  49. $(STATIC): $(OBJ)
  50. @echo "[Link (Static)]"
  51. @ar rcs $(STATIC) $(OBJ)
  52. @ranlib $(STATIC)
  53. # @size $(STATIC)
  54. $(DYNAMIC): $(OBJ)
  55. @echo "[Link (Dynamic)]"
  56. @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
  57. i2c: $(OBJ) $(OBJ_I2C)
  58. @echo "[Link (Dynamic + I2C)]"
  59. @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ) $(OBJ_I2C)
  60. .c.o:
  61. @echo [Compile] $<
  62. @$(CC) -c $(CFLAGS) $< -o $@
  63. .PHONEY: clean
  64. clean:
  65. rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
  66. .PHONEY: tags
  67. tags: $(SRC)
  68. @echo [ctags]
  69. @ctags $(SRC)
  70. .PHONEY: install
  71. install: $(DYNAMIC)
  72. @echo "[Install]"
  73. @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  74. @install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  75. @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
  76. @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
  77. @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
  78. @install -m 0644 gertboard.h $(DESTDIR)$(PREFIX)/include
  79. @install -m 0644 piNes.h $(DESTDIR)$(PREFIX)/include
  80. @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
  81. @install -m 0644 softServo.h $(DESTDIR)$(PREFIX)/include
  82. @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
  83. @install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
  84. @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
  85. @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
  86. @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
  87. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
  88. @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
  89. @ldconfig
  90. .PHONEY: install-static
  91. install-static: $(STATIC)
  92. @echo "[Install Static]"
  93. @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
  94. .PHONEY: uninstall
  95. uninstall:
  96. @echo "[UnInstall]"
  97. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
  98. @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
  99. @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
  100. @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
  101. @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
  102. @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
  103. @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
  104. @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
  105. @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
  106. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
  107. @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
  108. @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
  109. @ldconfig
  110. .PHONEY: depend
  111. depend:
  112. makedepend -Y $(SRC) $(SRC_I2C)
  113. # DO NOT DELETE
  114. wiringPi.o: wiringPi.h
  115. wiringPiFace.o: wiringPi.h
  116. wiringSerial.o: wiringSerial.h
  117. wiringShift.o: wiringPi.h wiringShift.h
  118. gertboard.o: wiringPiSPI.h gertboard.h
  119. piNes.o: wiringPi.h piNes.h
  120. lcd.o: wiringPi.h lcd.h
  121. piHiPri.o: wiringPi.h
  122. piThread.o: wiringPi.h
  123. wiringPiSPI.o: wiringPiSPI.h
  124. softPwm.o: wiringPi.h softPwm.h
  125. softServo.o: wiringPi.h softServo.h
  126. softTone.o: wiringPi.h softTone.h
  127. wiringPiI2C.o: wiringPi.h wiringPiI2C.h