From edc9b406366d8abdad84f41c90a13e510b313cb9 Mon Sep 17 00:00:00 2001 From: structix Date: Wed, 13 Dec 2017 15:42:10 +0100 Subject: [PATCH] Added makefile. Fixed char pointer warnings --- .gitignore | 2 ++ csoundbox.c | 12 ++++++++++-- makefile | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 makefile diff --git a/.gitignore b/.gitignore index 0ee7235..328f4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ Module.symvers Mkfile.old dkms.conf +*.mp3 +/csoundbox diff --git a/csoundbox.c b/csoundbox.c index 825a575..5a16cb4 100644 --- a/csoundbox.c +++ b/csoundbox.c @@ -1,8 +1,15 @@ #include #include +#include +#include #define BITS 8 +void exitfunction(void) { + + printf("Exiting csoundbox.\n"); +} + int main(int argc, char *argv[]) { mpg123_handle *mh; @@ -17,7 +24,8 @@ int main(int argc, char *argv[]) ao_sample_format format; int channels, encoding; long rate; - + + atexit(exitfunction); if(argc < 2) exit(0); @@ -43,7 +51,7 @@ int main(int argc, char *argv[]) /* decode and play */ while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK) - ao_play(dev, buffer, done); + ao_play(dev, (char *)buffer, done); /* clean up */ free(buffer); diff --git a/makefile b/makefile new file mode 100644 index 0000000..dcde6db --- /dev/null +++ b/makefile @@ -0,0 +1,20 @@ +#Infos: http://www.ijon.de/comp/tutorials/makefile.html + + +VERSION = 1.0 +CC = cc +CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\" +#LDFLAGS = -lm -lpthread `gtk-config --cflags` `gtk-config --libs` -lgthread +LDFLAGS = -lmpg123 -lao + +OBJ = csoundbox.o + +all: $(OBJ) + $(CC) $(CFLAGS) -o csoundbox $(OBJ) $(LDFLAGS) + +%.o: %.c + $(CC) $(CFLAGS) -c $< + +.PHONY: clean +clean: + rm -r *.o