Gordons Projects

--> Projects Top-Level GIT

Updating for various stuff and bugs. CM3+ and PiA3+
[wiringPi] / wiringPi / Makefile
index c6a4555..d8639e8 100644 (file)
@@ -1,8 +1,8 @@
-# ;
+#
 # Makefile:
 #      wiringPi - Wiring Compatable library for the Raspberry Pi
 #
-#      Copyright (c) 2012 Gordon Henderson
+#      Copyright (c) 2012-2015 Gordon Henderson
 #################################################################################
 # This file is part of wiringPi:
 #      https://projects.drogon.net/raspberry-pi/wiringpi/
 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
 #################################################################################
 
-DYN_VERS_MAJ=1
-DYN_VERS_MIN=0
+VERSION=$(shell cat ../VERSION)
+DESTDIR?=/usr
+PREFIX?=/local
+
+LDCONFIG?=ldconfig
 
-VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
-DESTDIR=/usr
-PREFIX=/local
+ifneq ($V,1)
+Q ?= @
+endif
 
 STATIC=libwiringPi.a
 DYNAMIC=libwiringPi.so.$(VERSION)
 
 #DEBUG = -g -O0
 DEBUG  = -O2
-CC     = gcc
 INCLUDE        = -I.
-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe -fPIC
+DEFS   = -D_GNU_SOURCE
+CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
+#CFLAGS        = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC
 
-LIBS    =
+LIBS    = -lm -lpthread -lrt -lcrypt
 
-# Should not alter anything below this line
 ###############################################################################
 
-SRC    =       wiringPi.c wiringPiFace.c wiringSerial.c wiringShift.c  \
-               gertboard.c                                             \
-               piNes.c                                                 \
-               lcd.c piHiPri.c piThread.c                              \
-               wiringPiSPI.c                                           \
-               softPwm.c softServo.c softTone.c
-
-SRC_I2C        =       wiringPiI2C.c
+SRC    =       wiringPi.c                                              \
+               wiringSerial.c wiringShift.c                            \
+               piHiPri.c piThread.c                                    \
+               wiringPiSPI.c wiringPiI2C.c                             \
+               softPwm.c softTone.c                                    \
+               mcp23008.c mcp23016.c mcp23017.c                        \
+               mcp23s08.c mcp23s17.c                                   \
+               sr595.c                                                 \
+               pcf8574.c pcf8591.c                                     \
+               mcp3002.c mcp3004.c mcp4802.c mcp3422.c                 \
+               max31855.c max5322.c ads1115.c                          \
+               sn3218.c                                                \
+               bmp180.c htu21d.c ds18b20.c rht03.c                     \
+               drcSerial.c drcNet.c                                    \
+               pseudoPins.c                                            \
+               wpiExtensions.c
+
+HEADERS =      $(shell ls *.h)
 
 OBJ    =       $(SRC:.c=.o)
 
-OBJ_I2C        =       $(SRC_I2C:.c=.o)
-
 all:           $(DYNAMIC)
 
-static:                $(STATIC)
-
-$(STATIC):     $(OBJ)
-       @echo "[Link (Static)]"
-       @ar rcs $(STATIC) $(OBJ)
-       @ranlib $(STATIC)
-#      @size   $(STATIC)
+.PHONY:        static
+static:        
+               $Q cat noMoreStatic
 
 $(DYNAMIC):    $(OBJ)
-       @echo "[Link (Dynamic)]"
-       @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ)
-
-i2c:   $(OBJ) $(OBJ_I2C)
-       @echo "[Link (Dynamic + I2C)]"
-       @$(CC) -shared -Wl,-soname,libwiringPi.so.1 -o libwiringPi.so.1.0 -lpthread $(OBJ) $(OBJ_I2C)
+       $Q echo "[Link (Dynamic)]"
+       $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
 
 .c.o:
-       @echo [Compile] $<
-       @$(CC) -c $(CFLAGS) $< -o $@
+       $Q echo [Compile] $<
+       $Q $(CC) -c $(CFLAGS) $< -o $@
 
-.PHONEY:       clean
+
+.PHONY:        clean
 clean:
-       rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
+       $Q echo "[Clean]"
+       $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
 
-.PHONEY:       tags
+.PHONY:        tags
 tags:  $(SRC)
-       @echo [ctags]
-       @ctags $(SRC)
+       $Q echo [ctags]
+       $Q ctags $(SRC)
+
 
-.PHONEY:       install
+.PHONY:        install
 install:       $(DYNAMIC)
-       @echo "[Install]"
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPi.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringSerial.h         $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringShift.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 softPwm.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 softServo.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 softTone.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPiSPI.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPiI2C.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0755 libwiringPi.so.$(VERSION)                $(DESTDIR)$(PREFIX)/lib
-       @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
-       @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so.1
-       @ldconfig
-
-.PHONEY:       install-static
-install-static:        $(STATIC)
-       @echo "[Install Static]"
-       @install -m 0755 libwiringPi.a          $(DESTDIR)$(PREFIX)/lib
-
-.PHONEY:       uninstall
+       $Q echo "[Install Headers]"
+       $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/include
+       $Q install -m 0644 $(HEADERS)                                   $(DESTDIR)$(PREFIX)/include
+       $Q echo "[Install Dynamic Lib]"
+       $Q install -m 0755 -d                                           $(DESTDIR)$(PREFIX)/lib
+       $Q install -m 0755 libwiringPi.so.$(VERSION)                    $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
+       $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)     $(DESTDIR)/lib/libwiringPi.so
+       $Q $(LDCONFIG)
+
+.PHONY:        install-deb
+install-deb:   $(DYNAMIC)
+       $Q echo "[Install Headers: deb]"
+       $Q install -m 0755 -d                                                   ~/wiringPi/debian-template/wiringPi/usr/include
+       $Q install -m 0644 $(HEADERS)                                           ~/wiringPi/debian-template/wiringPi/usr/include
+       $Q echo "[Install Dynamic Lib: deb]"
+       install -m 0755 -d                                                      ~/wiringPi/debian-template/wiringPi/usr/lib
+       install -m 0755 libwiringPi.so.$(VERSION)                               ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
+       ln -sf ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so.$(VERSION)    ~/wiringPi/debian-template/wiringPi/usr/lib/libwiringPi.so
+
+.PHONY:        uninstall
 uninstall:
-       @echo "[UnInstall]"
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/softServo.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
-       @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
-       @ldconfig
-
-
-.PHONEY:       depend
+       $Q echo "[UnInstall]"
+       $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
+       $Q cd $(DESTDIR)$(PREFIX)/lib/     && rm -f libwiringPi.*
+       $Q $(LDCONFIG)
+
+
+.PHONY:        depend
 depend:
        makedepend -Y $(SRC) $(SRC_I2C)
 
 # DO NOT DELETE
 
-wiringPi.o: wiringPi.h
-wiringPiFace.o: wiringPi.h
+wiringPi.o: softPwm.h softTone.h wiringPi.h ../version.h
 wiringSerial.o: wiringSerial.h
 wiringShift.o: wiringPi.h wiringShift.h
-gertboard.o: wiringPiSPI.h gertboard.h
-piNes.o: wiringPi.h piNes.h
-lcd.o: wiringPi.h lcd.h
 piHiPri.o: wiringPi.h
 piThread.o: wiringPi.h
-wiringPiSPI.o: wiringPiSPI.h
+wiringPiSPI.o: wiringPi.h wiringPiSPI.h
+wiringPiI2C.o: wiringPi.h wiringPiI2C.h
 softPwm.o: wiringPi.h softPwm.h
-softServo.o: wiringPi.h softServo.h
 softTone.o: wiringPi.h softTone.h
-wiringPiI2C.o: wiringPi.h wiringPiI2C.h
+mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h
+mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h
+mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h
+mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h
+mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h
+sr595.o: wiringPi.h sr595.h
+pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h
+pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h
+mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h
+mcp3004.o: wiringPi.h wiringPiSPI.h mcp3004.h
+mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h
+mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h
+max31855.o: wiringPi.h wiringPiSPI.h max31855.h
+max5322.o: wiringPi.h wiringPiSPI.h max5322.h
+ads1115.o: wiringPi.h wiringPiI2C.h ads1115.h
+sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
+bmp180.o: wiringPi.h wiringPiI2C.h bmp180.h
+htu21d.o: wiringPi.h wiringPiI2C.h htu21d.h
+ds18b20.o: wiringPi.h ds18b20.h
+drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
+pseudoPins.o: wiringPi.h pseudoPins.h
+wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
+wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
+wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h ads1115.h sn3218.h
+wpiExtensions.o: drcSerial.h pseudoPins.h bmp180.h htu21d.h ds18b20.h
+wpiExtensions.o: wpiExtensions.h