From 7859ac9d397cdab40c5f9cc4cb63f42c04798750 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Wed, 4 Nov 2015 10:31:54 +0100 Subject: [PATCH] getopt() now works in ddcd. Also fixed Makefile for only compiling those targets that have their corresponding sources changed. --- Makefile | 10 ++++++++-- ddcd.c | 26 +++++++++++++++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 4bcd3f8..818f1fc 100644 --- a/Makefile +++ b/Makefile @@ -43,20 +43,26 @@ PARAMS_SO = -fpic PARAMS_MISC = -Wno-unused-result FFTW_PACKAGE = fftw-3.3.3 -all: clean-vect +.PHONY: clean-vect clean +all: csdr ddcd +libcsdr.so: fft_fftw.c fft_rpi.c libcsdr_wrapper.c libcsdr.c libcsdr_gpl.c @echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\). @echo Auto-detected optimization parameters: $(PARAMS_SIMD) @echo + rm -f dumpvect*.vect gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so -./parsevect dumpvect*.vect +csdr: csdr.c libcsdr.so gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr +ddcd: ddcd.c libcsdr.so + gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) ddcd.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o ddcd arm-cross: clean-vect #note: this doesn't work since having added FFTW arm-linux-gnueabihf-gcc -std=gnu99 -O3 -fshort-double -ffast-math -dumpbase dumpvect-arm -fdump-tree-vect-details -mfloat-abi=softfp -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mvectorize-with-neon-quad -Wno-unused-result -Wformat=0 $(SOURCES) -lm -o ./csdr clean-vect: rm -f dumpvect*.vect clean: clean-vect - rm -f libcsdr.so csdr + rm -f libcsdr.so csdr ddcd install: install -m 0755 libcsdr.so /usr/lib install -m 0755 csdr /usr/bin diff --git a/ddcd.c b/ddcd.c index f93d1ce..5dd0bd1 100644 --- a/ddcd.c +++ b/ddcd.c @@ -31,8 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#include - +#define SOFTWARE_NAME "ddcd" +#define MSG_START SOFTWARE_NAME ": " struct client_s { @@ -40,16 +43,16 @@ struct client_s int addr; } client_t; - +int host_port = 0; +char host_address[100] = "127.0.0.1"; +int decimation = 0; int main(int argc, char* argv[]) { int c; //arguments: - int host_port; - char host_address[100] = "127.0.0.1"; - int decimation; + for(;;) { @@ -75,16 +78,16 @@ int main(int argc, char* argv[]) break; case 0: case '?': + case ':': default: printf(" 0%o ??\n", c); } - - - - } - - struct sockaddr_in addr_host; + + if(!decimation) { fprintf(stderr, MSG_START "missing required command line argument, --decimation.\n"); exit(1); } + if(!host_port) { fprintf(stderr, MSG_START "missing required command line argument, --port.\n"); exit(1); } + + /*struct sockaddr_in addr_host; int listen_socket; std::vector clients; listen_socket=socket(AF_INET,SOCK_STREAM,0); @@ -92,5 +95,6 @@ int main(int argc, char* argv[]) addr_host.sin_family=AF_INET; addr_host.sin_port=htons(8888); addr_host.sin_addr.s_addr=inet_addr("127.0.0.1"); + */ }