getopt() now works in ddcd. Also fixed Makefile for only compiling those targets that have their corresponding sources changed.

This commit is contained in:
ha7ilm 2015-11-04 10:31:54 +01:00
parent 2e55381198
commit 7859ac9d39
2 changed files with 23 additions and 13 deletions

View file

@ -43,20 +43,26 @@ PARAMS_SO = -fpic
PARAMS_MISC = -Wno-unused-result PARAMS_MISC = -Wno-unused-result
FFTW_PACKAGE = fftw-3.3.3 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 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 Auto-detected optimization parameters: $(PARAMS_SIMD)
@echo @echo
rm -f dumpvect*.vect
gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so
-./parsevect dumpvect*.vect -./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 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 arm-cross: clean-vect
#note: this doesn't work since having added FFTW #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 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: clean-vect:
rm -f dumpvect*.vect rm -f dumpvect*.vect
clean: clean-vect clean: clean-vect
rm -f libcsdr.so csdr rm -f libcsdr.so csdr ddcd
install: install:
install -m 0755 libcsdr.so /usr/lib install -m 0755 libcsdr.so /usr/lib
install -m 0755 csdr /usr/bin install -m 0755 csdr /usr/bin

24
ddcd.c
View file

@ -31,8 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
#include <string.h>
#include <stdlib.h>
#define SOFTWARE_NAME "ddcd"
#define MSG_START SOFTWARE_NAME ": "
struct client_s struct client_s
{ {
@ -40,16 +43,16 @@ struct client_s
int addr; int addr;
} client_t; } client_t;
int host_port = 0;
char host_address[100] = "127.0.0.1";
int decimation = 0;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int c; int c;
//arguments: //arguments:
int host_port;
char host_address[100] = "127.0.0.1";
int decimation;
for(;;) for(;;)
{ {
@ -75,16 +78,16 @@ int main(int argc, char* argv[])
break; break;
case 0: case 0:
case '?': case '?':
case ':':
default: default:
printf(" 0%o ??\n", c); 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; int listen_socket;
std::vector<client_t> clients; std::vector<client_t> clients;
listen_socket=socket(AF_INET,SOCK_STREAM,0); 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_family=AF_INET;
addr_host.sin_port=htons(8888); addr_host.sin_port=htons(8888);
addr_host.sin_addr.s_addr=inet_addr("127.0.0.1"); addr_host.sin_addr.s_addr=inet_addr("127.0.0.1");
*/
} }