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/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 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 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 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