Makefile
e60a9728
 # $Id$
 #
 # sip_router makefile
 #
1b1b19d8
 # WARNING: requires gmake (GNU Make)
f8734075
 #  Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 6)
e60a9728
 
71b44bf0
 lex_f=lex.yy.c
 yacc_f=cfg.tab.c
 sources= $(filter-out $(lex_f) $(yacc_f), $(wildcard *.c)) $(lex_f) \
 $(yacc_f) 
828920bb
 objs= $(sources:.c=.o)
e60a9728
 depends= $(sources:.c=.d)
 
 NAME=sip_router
 
726efa25
 # compile-time options
 # NOCR disables seeking for CRs -- breaks standard but is fast
 # recommended: on (speed-up, no implementation really sends CR)
 # MACROEATER replaces frequently called parser helper functions
 # with macros
 # recommanded: on (speed-up)
 DEFS=-DNOCR -DMACROEATER
 
f8734075
 # platform dependent settings
 
 ARCH = $(shell uname -s)
 
 ifeq ($(ARCH), Linux)
a15c363f
 
e60a9728
 CC=gcc
0ae4dfdc
 CFLAGS=-O2 -Wcast-align #-Wmissing-prototypes  -Wall
f8734075
 LEX=flex
 YACC=bison
71b44bf0
 YACC_FLAGS=-d -b cfg
1b1b19d8
 # on linux and freebsd keep it empty (e.g. LIBS= )
 # on solaris add -lxnet (e.g. LIBS= -lxnet)
f8734075
 LIBS=-lfl
 
 endif 
 ifeq  ($(ARCH), SunOS)
 
 MAKE=gmake
 CC=gcc
009edddc
 CFLAGS=-O2 -Wcast-align
f8734075
 LEX=flex
 YACC=yacc
 YACC_FLAGS=-d -b cfg
 LIBS=-lfl -L/usr/local/lib -lxnet # or -lnsl -lsocket or -lglibc ?
 
 endif
 ifeq ($(ARCH), FreeBSD)
 
 MAKE=gmake
 CC=gcc
009edddc
 CFLAGS=-O2 -Wcast-align
f8734075
 LEX=flex
 YACC=yacc
 YACC_FLAGS=-d -b cfg
 LIBS=-lfl
 
 endif
 
0ae4dfdc
 ifeq ($(ARCH), CYGWIN_NT-4.0)
 
 CC=gcc
 CFLAGS=-O2 -Wcast-align #-Wmissing-prototypes  -Wall
 LEX=flex
 YACC=bison
 YACC_FLAGS=-d -b cfg
 # on linux and freebsd keep it empty (e.g. LIBS= )
 # on solaris add -lxnet (e.g. LIBS= -lxnet)
 LIBS=-lfl
 
 endif
 
e60a9728
 
726efa25
 MKDEP=gcc -M $(DEFS)
e60a9728
 
f8734075
 ALLDEP=Makefile
e60a9728
 
 #implicit rules
 
a15c363f
 
e60a9728
 %.o:%.c $(ALLDEP)
726efa25
 	$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
e60a9728
 
 %.d: %.c
 	$(MKDEP) $< >$@
 
a15c363f
 # normal rules
3e429f5c
 $(NAME): $(objs)
 	$(CC) $(CFLAGS) $(objs) -o $(NAME) $(LIBS)
 
a15c363f
 lex.yy.c: cfg.lex $(ALLDEP)
 	$(LEX) $<
 
f8734075
 cfg.tab.c: cfg.y $(ALLDEP)
a15c363f
 	$(YACC) $(YACC_FLAGS) $<
 
e60a9728
 
 .PHONY: all
 all: $(NAME)
 
 .PHONY: dep
 dep: $(depends)
 
 .PHONY: clean
 clean:
 	-rm $(objs) $(NAME)
 
 .PHONY: proper
 proper: clean
 	-rm $(depends)
 
 include $(depends)