# -*- makefile -*-

OBJECTS = init.o poll.o errors.o processx-connection.o   \
          processx-vector.o create-time.o base64.o       \
	  unix/childlist.o unix/connection.o             \
          unix/processx.o unix/sigchld.o unix/utils.o    \
	  unix/named_pipe.o cleancall.o

.PHONY: all clean

all: tools/px supervisor/supervisor client$(SHLIB_EXT) $(SHLIB)

tools/px: tools/px.c
	$(CC) $(CFLAGS) $(LDFLAGS) -Wall tools/px.c -o tools/px

supervisor/supervisor: supervisor/supervisor.c supervisor/utils.c
	$(CC) $(CFLAGS) $(LDFLAGS) supervisor/supervisor.c \
	      supervisor/utils.c -o supervisor/supervisor

CLIENT_OBJECTS = base64.o client.o errors.o

client$(SHLIB_EXT): $(CLIENT_OBJECTS)
	$(SHLIB_LINK) -o client$(SHLIB_EXT) $(CLIENT_OBJECTS) $(PKG_LIBS) \
		$(SHLIB_LIBADD) $(LIBR)

clean:
	rm -rf $(SHLIB) $(OBJECTS) $(CLIENT_OBJECTS)		\
	    supervisor/supervisor supervisor/supervisor.dSYM 	\
	    supervisor/supervisor.exe				\
	    client$(SHLIB_EXT)
