
#
# Erlang Makefile 
#
# Requires gnumake
# 
# $Id: Makefile,v 1.1 1998/04/28 07:20:13 geoff Exp $
#
# $Source: /home/cvs/gerl/node/Makefile,v $
# $Revision: 1.1 $
# $Date: 1998/04/28 07:20:13 $
# $State: Exp $
#
# Author: Geoff Wong
# Copyright (C) 1996, 1997 Geoff Wong
# geoff@cs.rmit.edu.au
#


#
# Compiler Stuff
#

CC=gcc
INCLUDE=
CFLAGS=-Wall -g 

#
# Some operating system dependent trickery
#

OS=$(shell uname)
OBJPATH=obj/$(OS)
VPATH=$(OBJPATH)
DEFS=-D$(OS)

#
# Libs
#

ifeq ($(OS),SunOS)
	LIBS=-lsocket -lnsl -lc -ldl
else
	LIBS=-ldl -lc 
endif

SHLIBS=-Lerlib -lerl

#
# The compiler source code
#

SRC1 = server.c
SRC2 = message.c
SRC3 = client.c

#

OBJ1 := $(SRC1:%.c=%.o)
OBJ2 := $(SRC2:%.c=%.o)
OBJ3 := $(SRC3:%.c=%.o)

%.o: %.cc
	$(CC) $(PROF) -c $(CFLAGS) $(DEFS) $(INCLUDE) $< -o $@

all: server client message

server: $(OBJ1) 
	$(CC) -o server -g $(OBJ1) $(INCLUDE) $(DEFS) $(LIBS)

message: $(OBJ2) 
	$(CC) -o message -g $(OBJ2) $(INCLUDE) $(DEFS) $(LIBS)

client: $(OBJ3) 
	$(CC) -o client -g $(OBJ3) $(INCLUDE) $(DEFS) $(LIBS)

tags: $(SRC1) $(SRC2) $(SRC3)
	ctags $(SRC1) $(SRC2) $(SRC3)

clean:
	rm $(OBJ1) $(OBJ2) $(OBJ3)

veryclean: clean
	rm server message client

.PHONY: depend 

# Depend stuff below (do not change!)
depend: $(SRC1) $(SRC2) $(SRC3)
	$(CC) -MM $(SRC1) $(SRC2) $(SRC3) $(INCLUDE) > .depend

-include .depend

