# If compiling for Windows, uncomment the $(WINLIBS) part of "LIBS :="
WINLIBS := -lws2_32
LIBS := #$(WINLIBS)

CARGS := -O2 -c -Wall
LDARGS := -O2 $(LIBS)

CMDLOBJS := cmdline.o translate.o winamp.o
SERVOBJS := translate.o rpcserver.o rpc.o winamp.o
CLNTOBJS := rpcclient.o rpc.o

OBJS := cmdline.o rpc.o rpcclient.o rpcserver.o translate.o winamp.o

HFILES := translate.h rpc.h winamp.h

all: cmdline server client

cmdline: $(CMDLOBJS)
	$(CC) $(CMDLOBJS) $(LDARGS) -o $@

server: $(SERVOBJS)
	$(CC) $(SERVOBJS) $(LDARGS) -o $@

client: $(CLNTOBJS)
	$(CC) $(CLNTOBJS) $(LDARGS) -o $@

%.o: %.c $(HFILES)
	$(CC) $(CARGS) $*.c
