diff --git a/moc_test/Makefile b/moc_test/Makefile index 5aeb65f..f16d1bc 100644 --- a/moc_test/Makefile +++ b/moc_test/Makefile @@ -4,7 +4,7 @@ all: gcc -Wall -c librtlsdr_moc.c -o librtlsdr_moc.o ar rcs librtlsdr_moc.a librtlsdr_moc.o - CC="gcc -DMOCK_TEST" go build --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go + CC="gcc -DMOCK_TEST" go build -tags 'MOC_TEST' --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go go build main_moc.go clean: diff --git a/rtlsdr.go b/rtlsdr.go index cd6f588..72d5624 100644 --- a/rtlsdr.go +++ b/rtlsdr.go @@ -18,21 +18,23 @@ import ( // If building libusb from source, to regenerate the configure file use: // $ autoreconf -fvi // -#ifdef MOC_TEST -// to build: +// to build the moc test: // $ gcc -Wall -c librtlsdr_moc.c -o librtlsdr_moc.o // $ ar rcs librtlsdr_moc.a librtlsdr_moc.o -// $ CC="gcc -DMOCK_TEST" go build --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go +// $ CC="gcc -DMOCK_TEST" go build -tags 'MOC_TEST' --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go // -#cgo LDFLAGS: -L./moc_test -lrtlsdr_moc -#include -#include -#else + +#cgo MOC_TEST LDFLAGS: -L./moc_test -lrtlsdr_moc + #cgo linux LDFLAGS: -lrtlsdr #cgo darwin LDFLAGS: -lrtlsdr #cgo windows CFLAGS: -IC:/WINDOWS/system32 #cgo windows LDFLAGS: -lrtlsdr -LC:/WINDOWS/system32 + #include +#ifdef MOC_TEST +#include +#else #include #endif