diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f90b5f7 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +CFLAGS?=-O2 -g -Wall -W $(shell pkg-config --cflags librtlsdr) +CFLAGS+= -I./aisdecoder -I ./aisdecoder/lib +LDFLAGS+=$(shell pkg-config --libs librtlsdr) -lpthread -lm +CC?=gcc +SOURCES= \ + rtl_ais.c convenience.c \ + ./aisdecoder/aisdecoder.c \ + ./aisdecoder/sounddecoder.c \ + ./aisdecoder/lib/receiver.c \ + ./aisdecoder/lib/protodec.c \ + ./aisdecoder/lib/hmalloc.c \ + ./aisdecoder/lib/filter.c + +OBJECTS=$(SOURCES:.c=.o) +EXECUTABLE=rtl_ais + +all: $(SOURCES) $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(CC) $(OBJECTS) -o $@ $(LDFLAGS) + +.c.o: + $(CC) -c $< -o $@ $(CFLAGS) + +clean: + rm -f $(OBJECTS) $(EXECUTABLE) diff --git a/build.sh b/build.sh deleted file mode 100755 index b59805d..0000000 --- a/build.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# todo, a real makefile - -#point this to the correct path -RTLSDR_PATH="/tmp/rtl-sdr-exp/src" - -files="rtl_ais.c convenience.c \ - ./aisdecoder/aisdecoder.c ./aisdecoder/sounddecoder.c \ - ./aisdecoder/lib/receiver.c - ./aisdecoder/lib/protodec.c - ./aisdecoder/lib/hmalloc.c - ./aisdecoder/lib/filter.c " - -flags="-Wall -O2 " -includes="-I/usr/include/libusb-1.0 -I./aisdecoder -I ./aisdecoder/lib" -libs="-L/usr/lib -L. -lusb-1.0 -lrtlsdr -lpthread -lm " - -UNAME=$(uname) -if [ "$UNAME" != "Linux" ] -then -# Conditional section for Windows - libs="$libs -lWs2_32" -fi - -rm -f rtl_ais -echo gcc -o rtl_ais $files $flags $includes $libs -gcc -o rtl_ais $files $flags $includes $libs -