targets = proto pproto proto_static pproto_static

objects = dec_mpg123.o out_dummy.o

headers = decoders.h output.h common.h dec_mpg123.h out_dummy.h

LDFLAGS = -lpthread

CC = g++ 

all: $(targets) strip

%.o:%.cpp %.h
	$(CC) -D_REENTRANT -Wall $(CFLAGS) -c -o $@ $<

proto: proto.c
	gcc -D_REENTRANT -lpthread -o $@ $<

pproto: proto.cpp $(objects) proto.o $(headers) 
	$(CC) -D_REENTRANT -Wall $(CFLAGS) $(LDFLAGS) -o $@ $(objects) proto.o


beispiel: beispiel.c
	gcc -D_REENTRANT -lpthread -o beispiel beispiel.c

proto_static: proto.c
	gcc -D_REENTRANT -o $@ $< -lpthread -static
	strip --strip-debug $@

pproto_static: proto.cpp
	g++ -D_REENTRANT -o $@ $< -lpthread -static

clean:
	rm -vf $(targets) $(objects) strip

strip: $(targets)
	strip --strip-debug $(targets) && touch strip
