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.
 
 
 
 
 

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