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.
 
 
 
 
 

141 rivejä
4.1 KiB

  1. #
  2. # Makefile:
  3. # wiringPi device - 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. LDCONFIG?=ldconfig
  27. ifneq ($V,1)
  28. Q ?= @
  29. endif
  30. STATIC=libwiringPiDev.a
  31. DYNAMIC=libwiringPiDev.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 -Winline $(INCLUDE) -pipe -fPIC
  38. LIBS =
  39. ###############################################################################
  40. SRC = ds1302.c maxdetect.c piNes.c \
  41. gertboard.c piFace.c \
  42. lcd128x64.c lcd.c \
  43. scrollPhat.c \
  44. piGlow.c
  45. OBJ = $(SRC:.c=.o)
  46. HEADERS = ds1302.h gertboard.h lcd128x64.h lcd.h maxdetect.h piFace.h piGlow.h piNes.h\
  47. scrollPhat.h
  48. all: $(DYNAMIC)
  49. static: $(STATIC)
  50. $(STATIC): $(OBJ)
  51. $Q echo "[Link (Static)]"
  52. $Q ar rcs $(STATIC) $(OBJ)
  53. $Q ranlib $(STATIC)
  54. # @size $(STATIC)
  55. $(DYNAMIC): $(OBJ)
  56. $Q echo "[Link (Dynamic)]"
  57. $Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
  58. .c.o:
  59. $Q echo [Compile] $<
  60. $Q $(CC) -c $(CFLAGS) $< -o $@
  61. .PHONY: clean
  62. clean:
  63. $Q echo "[Clean]"
  64. $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
  65. .PHONY: tags
  66. tags: $(SRC)
  67. $Q echo [ctags]
  68. $Q ctags $(SRC)
  69. .PHONY: install
  70. install: $(DYNAMIC)
  71. $Q echo "[Install Headers]"
  72. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  73. $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
  74. $Q echo "[Install Dynamic Lib]"
  75. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  76. $Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
  77. $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
  78. $Q $(LDCONFIG)
  79. .PHONY: install-static
  80. install-static: $(STATIC)
  81. $Q echo "[Install Headers]"
  82. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
  83. $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
  84. $Q echo "[Install Static Lib]"
  85. $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
  86. $Q install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib
  87. .PHONY: install-deb
  88. install-deb: $(DYNAMIC)
  89. $Q echo "[Install Headers: deb]"
  90. $Q install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/include
  91. $Q install -m 0644 $(HEADERS) ~/wiringPi/debian-template/wiringPi/usr/include
  92. $Q echo "[Install Dynamic Lib: deb]"
  93. install -m 0755 -d ~/wiringPi/debian-template/wiringPi/usr/lib
  94. install -m 0755 libwiringPiDev.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION)
  95. ln -sf ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION) ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPiDev.so
  96. .PHONY: uninstall
  97. uninstall:
  98. $Q echo "[UnInstall]"
  99. $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
  100. $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
  101. $Q $(LDCONFIG)
  102. .PHONY: depend
  103. depend:
  104. makedepend -Y $(SRC)
  105. # DO NOT DELETE
  106. ds1302.o: ds1302.h
  107. maxdetect.o: maxdetect.h
  108. piNes.o: piNes.h
  109. gertboard.o: gertboard.h
  110. piFace.o: piFace.h
  111. lcd128x64.o: font.h lcd128x64.h
  112. lcd.o: lcd.h
  113. scrollPhat.o: scrollPhatFont.h scrollPhat.h
  114. piGlow.o: piGlow.h