Makefile 4.0 KB

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