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.
 
 
 
 
 

142 line
4.1 KiB

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