From 8447cd8f6e2b22a4f24d03c978f74344c7e0a1b2 Mon Sep 17 00:00:00 2001 From: Michael Ambrus Date: Sat, 13 Jan 2018 19:38:48 +0100 Subject: [PATCH 1/4] Root-directory Makefile bug-fixes * Builds the examples as documented * .PHONY for non-file targets * CFLAGS exported for examples to build when built from root-directory Makefile --- src/Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Makefile.in b/src/Makefile.in index 25e8434..fa209fa 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,3 +1,4 @@ +.PHONY: all clean install uninstall clean distclean examples pyswig-build pyswig-install pyswig-uninstall py-build py-install py-uninstall CC=@CC@ SWIG=@SWIG@ PYDEV=@PYDEV@ @@ -15,6 +16,8 @@ INCDIR=@includedir@ INC=-I$(PYDEV) TARGET=mpsse +export CFLAGS + all: $(TARGET) py$(BUILD)-build $(TARGET): mpsse.o fast.o @@ -22,7 +25,7 @@ $(TARGET): mpsse.o fast.o -o lib$(TARGET).so $(LDFLAGS) ar rcs lib$(TARGET).a $(TARGET).o fast.o support.o -example-code: +examples: make -C examples mpsse.o: support.o From eb6d82d260a811c659603862407f7c274d2a7e5d Mon Sep 17 00:00:00 2001 From: Michael Ambrus Date: Sat, 20 Jan 2018 10:34:15 +0100 Subject: [PATCH 2/4] Missing "#include " corrected Gets rid of clobbering warnings --- src/examples/bitbang.c | 1 + src/examples/gpio.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/examples/bitbang.c b/src/examples/bitbang.c index 68e9ec6..1f10a00 100644 --- a/src/examples/bitbang.c +++ b/src/examples/bitbang.c @@ -1,5 +1,6 @@ #include #include +#include #include int main(void) diff --git a/src/examples/gpio.c b/src/examples/gpio.c index 326b626..a96c332 100644 --- a/src/examples/gpio.c +++ b/src/examples/gpio.c @@ -1,4 +1,5 @@ #include +#include #include #include From b164fb43b81c20c8c38414bb8ab898ead2114fb8 Mon Sep 17 00:00:00 2001 From: Michael Ambrus Date: Sat, 20 Jan 2018 12:20:40 +0100 Subject: [PATCH 3/4] .gitignore files(2) added --- src/.gitignore | 43 +++++++++++++++++++++++++++++++++++++++++ src/examples/.gitignore | 11 +++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/.gitignore create mode 100644 src/examples/.gitignore diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..19ceeb4 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,43 @@ +# back-up files (vim etc) +*.*~ + +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ + +# Cmake temp & generated files +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +Makefile +*config.h + diff --git a/src/examples/.gitignore b/src/examples/.gitignore new file mode 100644 index 0000000..266b29f --- /dev/null +++ b/src/examples/.gitignore @@ -0,0 +1,11 @@ +# Additional gitignore +# Exclude all built executables. + +bitbang +ds1305 +gpio +i2ceeprom +spiflash +spiflashfast + +# No need to have patterns for windows *.exe as these are allready covered From 9afdc335171a7e02b9fb141bdd23e15b05648242 Mon Sep 17 00:00:00 2001 From: Michael Ambrus Date: Sat, 20 Jan 2018 10:24:44 +0100 Subject: [PATCH 4/4] Examples Makefile: CFLAGS and dependencies * Add default CFLAGS: If CFLAGS not given, i.e. passed from root-Makefile or this is a build from this directory without CFLAGS, make a fair guess. * Added simple dependencies to each target * Added .PHONY declaration for non-file targets --- src/examples/Makefile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/examples/Makefile b/src/examples/Makefile index 1c03853..0738d37 100644 --- a/src/examples/Makefile +++ b/src/examples/Makefile @@ -1,27 +1,36 @@ +.PHONY: clean distclean LDFLAGS=-lmpsse -all: spiflash spiflashfast i2ceeprom ds1305 gpio bitbang +# Define default CFLAGS if not given +# NOTE: You may want to adjust with local changes here +ifeq ($(CFLAGS),) + CFLAGS=-DLIBFTDI1=1 -O0 -g3 -ggdb +endif -spiflash: +TARGETS=spiflash spiflashfast i2ceeprom ds1305 gpio bitbang i2cpca9685 + +all: $(TARGETS) + +spiflash: spiflash.c $(CC) $(CFLAGS) spiflash.c -o spiflash $(LDFLAGS) -spiflashfast: +spiflashfast: spiflashfast.c $(CC) $(CFLAGS) spiflashfast.c -o spiflashfast $(LDFLAGS) -i2ceeprom: +i2ceeprom: i2ceeprom.c $(CC) $(CFLAGS) i2ceeprom.c -o i2ceeprom $(LDFLAGS) ds1305: $(CC) $(CFLAGS) ds1305.c -o ds1305 $(LDFLAGS) -gpio: +gpio: gpio.c $(CC) $(CFLAGS) gpio.c -o gpio $(LDFLAGS) -bitbang: +bitbang: bitbang.c $(CC) $(CFLAGS) bitbang.c -o bitbang $(LDFLAGS) clean: rm -f *.dSYM - rm -f bitbang gpio ds1305 i2ceeprom spiflash spiflashfast + rm -f $(TARGETS) distclean: clean