include ../mk/build.mk

INCLUDE_PATH	= ../include
HEADER_SUBDIR	= patty

CC		= $(CROSS)cc
CFLAGS		= $(CGFLAGS) -fPIC -Wall -O2 -I$(INCLUDE_PATH)
LDFLAGS		=

HEADERS		= kiss.h ax25.h ax25/if.h ax25/macros.h ax25/proto.h \
		  ax25/call.h ax25/frame.h ax25/sock.h ax25/route.h \
		  ax25/server.h list.h hash.h dict.h

OBJS		= kiss.o ax25.o if.o call.o frame.o sock.o route.o server.o \
		  list.o hash.o dict.o

EXAMPLES	= decode ptmx testclient testserver

HEADERS_BUILD	= $(addprefix $(INCLUDE_PATH)/$(HEADER_SUBDIR)/, $(HEADERS))

AR		= $(CROSS)ar
RANLIB		= $(CROSS)ranlib

RM		= /bin/rm
LN		= /bin/ln
RMDIR		= /bin/rmdir
INSTALL		= /usr/bin/install

all: $(EXAMPLES)

$(EXAMPLES): %: %.c $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $< -o $@

$(OBJS): %.o: %.c $(HEADERS_BUILD)
	$(CC) $(CFLAGS) -c $<

clean:
	$(RM) -f $(EXAMPLES) $(OBJS)