Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Makefile 4.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. 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 $(EXTRA_CFLAGS)
  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: check-deb-destdir
  88. check-deb-destdir:
  89. ifndef DEB_DESTDIR
  90. $(error DEB_DESTDIR is undefined)
  91. endif
  92. .PHONY: install-deb
  93. install-deb: $(DYNAMIC) check-deb-destdir
  94. $Q echo "[Install Headers: deb]"
  95. $Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
  96. $Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
  97. $Q echo "[Install Dynamic Lib: deb]"
  98. install -m 0755 -d $(DEB_DESTDIR)/usr/lib
  99. install -m 0755 libwiringPiDev.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so.$(VERSION)
  100. ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPiDev.so
  101. .PHONY: uninstall
  102. uninstall:
  103. $Q echo "[UnInstall]"
  104. $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
  105. $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
  106. $Q $(LDCONFIG)
  107. .PHONY: depend
  108. depend:
  109. makedepend -Y $(SRC)
  110. # DO NOT DELETE
  111. ds1302.o: ds1302.h
  112. maxdetect.o: maxdetect.h
  113. piNes.o: piNes.h
  114. gertboard.o: gertboard.h
  115. piFace.o: piFace.h
  116. lcd128x64.o: font.h lcd128x64.h
  117. lcd.o: lcd.h
  118. scrollPhat.o: scrollPhatFont.h scrollPhat.h
  119. piGlow.o: piGlow.h