# Makefile for the VideoLAN mini-server
# Regis Duchesne, VIA, ECP, France <regis@via.ecp.fr>, 20/01/97
#
# Note : You need a make clean each time you modify this Makefile.

############ Beginning of the configuration section ############

# Debug
#CFLAGS += -g

# Profile with gprof. Don't strip the executable file !
#CFLAGS += -g -pg

############ End of the configuration section ############

INSTALL=/usr/bin/install -c

CC = gcc

OBJ = \
   vlms.o \
   netutils.o \
   error.o \
   ts.o \
   ps.o

# GNU gcc parameters style
#CFLAGS += -O6 -Wall
CFLAGS += -g

# Generate the dependencies
CFLAGS += -MMD

# CLIENT or SERVER
CFLAGS += -DSERVER

# Use threads
CFLAGS += -D_REENTRANT
LIB += -lpthread

# Include the dependancies
ifeq (depend,$(wildcard depend))
all: vlms vlf
include depend
else
all: clean vlms vlf
endif

vlms: $(OBJ)
	cat *.d > depend
	rm -f *.d
	$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS) $(LOADLIBES) $(CFLAGS)
	chmod 755 $@

vlf: vlf.c
	$(CC) -o $@ $< $(CFLAGS)

clean:
	for i in $(OBJ); \
	do rm -f $$i; \
	done; \
	rm -f *.d depend

distclean: clean
	rm -f vlms vlf

install:
	$(INSTALL) vlms $(prefix)/bin
	#$(INSTALL) vlf $(prefix)/bin

