Browse code

- modified the Makefile (it should work out of the box on linux, freebsd and solaris)

Andrei Pelinescu-Onciul authored on 27/09/2001 13:01:22
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
 # sip_router makefile
4 4
 #
5 5
 # WARNING: requires gmake (GNU Make)
6
-#
6
+#  Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 6)
7 7
 
8 8
 lex_f=lex.yy.c
9 9
 yacc_f=cfg.tab.c
... ...
@@ -14,19 +14,49 @@ depends= $(sources:.c=.d)
14 14
 
15 15
 NAME=sip_router
16 16
 
17
+# platform dependent settings
18
+
19
+ARCH = $(shell uname -s)
20
+
21
+ifeq ($(ARCH), Linux)
17 22
 
18 23
 CC=gcc
19 24
 CFLAGS=-O2 -Wcast-align #-Wmissing-prototypes  -Wall
20
-LEX=lex
21
-YACC=yacc
25
+LEX=flex
26
+YACC=bison
22 27
 YACC_FLAGS=-d -b cfg
23 28
 # on linux and freebsd keep it empty (e.g. LIBS= )
24 29
 # on solaris add -lxnet (e.g. LIBS= -lxnet)
25
-LIBS=-lfl -L/usr/local/lib 
26
-ALLDEP=Makefile
30
+LIBS=-lfl
31
+
32
+endif 
33
+ifeq  ($(ARCH), SunOS)
34
+
35
+MAKE=gmake
36
+CC=gcc
37
+CFLAGS=-O2 -Wcase-align
38
+LEX=flex
39
+YACC=yacc
40
+YACC_FLAGS=-d -b cfg
41
+LIBS=-lfl -L/usr/local/lib -lxnet # or -lnsl -lsocket or -lglibc ?
42
+
43
+endif
44
+ifeq ($(ARCH), FreeBSD)
45
+
46
+MAKE=gmake
47
+CC=gcc
48
+CFLAGS=-O2 -Wcase-align
49
+LEX=flex
50
+YACC=yacc
51
+YACC_FLAGS=-d -b cfg
52
+LIBS=-lfl
53
+
54
+endif
55
+
27 56
 
28 57
 MKDEP=gcc -M
29 58
 
59
+ALLDEP=Makefile
30 60
 
31 61
 #implicit rules
32 62
 
... ...
@@ -44,7 +74,7 @@ $(NAME): $(objs)
44 44
 lex.yy.c: cfg.lex $(ALLDEP)
45 45
 	$(LEX) $<
46 46
 
47
-cfg.tab.c: cfg.y
47
+cfg.tab.c: cfg.y $(ALLDEP)
48 48
 	$(YACC) $(YACC_FLAGS) $<
49 49
 
50 50