File: Makefile

package info (click to toggle)
tcng 10b-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,636 kB
  • ctags: 2,515
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 756
file content (148 lines) | stat: -rwxr-xr-x 4,258 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#
# Makefile - Build tcc
#
# Written 2001,2002,2004 by Werner Almesberger
# Copyright 2001 EPFL-ICA, Network Robots
# Copyright 2002 Bivio Networks, Network Robots, Werner Almesberger
# Copyright 2004 Werner Almesberger
#

all:		tcc tcc-module ext meters.tc need-ports.tc

include ../Common.make

OBJS=lex.yy.o y.tab.o tcc.o util.o error.o var.o data.o param.o device.o \
     registry.o sprintf.o sprintf_generic.o \
     qdisc.o q_ingress.o q_cbq.o q_dsmark.o q_fifo.o q_gred.o q_prio.o \
     q_red.o q_sfq.o q_tbf.o q_htb.o csp.o \
     filter.o f_if.o f_fw.o f_route.o f_rsvp.o f_tcindex.o \
     police.o tc.o op.o field.o named.o \
     if_u32.o if_c.o if_ext.o iflib_actdb.o target.o location.o \
     iflib_comb.o iflib_off.o iflib_misc.o iflib_red.o iflib_act.o \
     iflib_arith.o iflib_not.o iflib_bit.o iflib_cheap.o iflib_newbit.o \
     iflib_fastbit.o ext_all.o ext.o ext_io.o ext_dump.o

CLEAN=lex.yy.c y.tab.c y.tab.h y.output $(OBJS) \
  param_decl.inc param_dsc.inc param_reset.inc \
  param_stack.inc param_push.inc param_pop.inc \
  meters.tc port-numbers.tmp tccmeta.h \
  .depend

SPOTLESS=tcc tcc-module

IMMACULATE=ports.tc port-numbers

#
# Note: we don't remove port-numbers, because re-creating the file requires
# network access. Also, removing port-numbers would violate the principle that
# "make spotless" does not remove files accessed by "make dist".
#

CFLAGS_CONFIG=-DVERSION=\"`cat ../VERSION`\" \
  $(shell sed '/TOPDIR=\(.*\)/s//-DTOPDIR=\\\"\1\\\"/p;d' <../config) \
  $(shell sed '/DATA_DIR=\(.*\)/s//-DDATA_DIR=\\\"\1\\\"/p;d' <../config) \
  $(shell sed '/DOLLAR=true/s//-DDOLLAR/p;d' <../config) \
  $(shell sed '/ACTION=false/s//-DCONFIRM_EXCEED/p;d' <../config)
CFLAGS=$(CC_OPTS) $(CFLAGS_WARN) -I../shared $(CFLAGS_CONFIG)
LIBS=-lfl -lm -L../shared -ltcngmisc $(LD_OPTS)

.PHONY:			all ext depend dep ephemeral clean spotless immaculate
.PHONY:			need-ports.tc ports.tc

tcc:			$(OBJS) Makefile ../Common.make
			$(CC) $(CC_OPTS) -o tcc $(OBJS) $(LIBS)

ext:
			$(MAKE) -C ext

lex.yy.c:		tcng.l y.tab.h
			$(LEX) tcng.l

lex.yy.o:		lex.yy.c y.tab.h
			$(CC) -c $(CFLAGS) -w lex.yy.c

y.tab.c y.tab.h:	tcng.y
			$(YACC) $(YYFLAGS) -d tcng.y

y.tab.o:		y.tab.c
			$(CC) -c $(CFLAGS) -w y.tab.c

param_decl.inc:		Parameters mkprminc
			./mkprminc decl >param_decl.inc || \
			  { rm -f param_decl.inc; exit 1; }

param_dsc.inc:		Parameters mkprminc
			./mkprminc dsc >param_dsc.inc || \
			  { rm -f param_dsc.inc; exit 1; }

param_reset.inc:	Parameters mkprminc
			./mkprminc reset >param_reset.inc || \
			  { rm -f param_reset.inc; exit 1; }

param_stack.inc:	Parameters mkprminc
			./mkprminc stack >param_stack.inc || \
			  { rm -f param_stack.inc; exit 1; }

param_push.inc:		Parameters mkprminc
			./mkprminc push >param_push.inc || \
			  { rm -f param_push.inc; exit 1; }

param_pop.inc:		Parameters mkprminc
			./mkprminc pop >param_pop.inc || \
			  { rm -f param_pop.inc; exit 1; }

param.c:		param_dsc.inc param_reset.inc param_stack.inc \
			param_push.inc param_pop.inc

tccmeta.h:		meta.tc meta.pl
			perl meta.pl >tccmeta.h || { rm -f tccmeta.h; exit 1; }

meters.tc:		meters.tc.in tcc_var2fix.pl Makefile
			./tcc_var2fix.pl meters.tc.in >meters.tc || \
			  { rm -f meters.tc; exit 1; }

need-ports.tc:
			[ -r ports.tc ] || $(MAKE) ports.tc

ports.tc:
			../scripts/update-port-numbers.sh || \
			  { rm -f port-numbers; exit 1; }
			../scripts/extract-port-numbers.pl port-numbers \
			  >ports.tc || { rm -f ports.tc; exit 1; }

tcc-module:		tcc-module.in ../config
			../scripts/topdir.sh .. tcc-module

$(OBJS):		.depend ../config \
			param_decl.inc # almost everything needs it

if_u32.o:		tccmeta.h
if_c.o:			tccmeta.h
tcc.o:			../VERSION

dep depend .depend:
			$(CPP) $(CFLAGS) -MM -MG \
			  `echo *.c | sed 's/\<tcm_\(cls\|f\)\.c\>//g'` \
			  >.depend || \
			  { rm -f .depend; exit 1; }

ephemeral:		ephemeral-mod
			echo $(CLEAN) $(SPOTLESS)
			$(MAKE) -C ext -s ephemeral | tr ' ' '\012' | \
			  sed 's|^|ext/|'

clean:			clean-mod
			$(MAKE) -C ext clean
			rm -f $(CLEAN)

spotless:		clean
			$(MAKE) -C ext spotless
			rm -f $(SPOTLESS)

immaculate:		spotless
			$(MAKE) -C ext immaculate
			rm -f $(IMMACULATE)

ifeq (.depend,$(wildcard .depend))
include .depend
endif