1#
2# Ethernet Switch IGMP Snooper
3# Copyright (C) 2014 ASUSTeK Inc.
4# All Rights Reserved.
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Affero General Public License as
8# published by the Free Software Foundation, either version 3 of the
9# License, or (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU Affero General Public License for more details.
15#
16# You should have received a copy of the GNU Affero General Public License
17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18#
19
20#CROSS = mipsel-uclibc-
21#CROSS = mipsel-linux-uclibc-
22#CROSS = arm-uclibc-
23#CC = $(CROSS)gcc
24
25CFLAGS = -Os -g -Wall -W -Wno-unused-parameter $(EXTRACFLAGS)
26LDFLAGS = $(EXTRALDFLAGS)
27
28CFLAGS += -ffunction-sections -fdata-sections
29LDFLAGS += -Wl,--gc-sections
30
31#CFLAGS += -DDEBUG
32#CFLAGS += -DDEBUG_IGMP
33#CFLAGS += -DDEBUG_IGMP_MORE
34#CFLAGS += -DDEBUG_TIMER
35#CFLAGS += -DDEBUG_CACHE
36#CFLAGS += -DDEBUG_SWITCH
37
38SWITCH ?= simul
39
40all: snooper
41
42snooper: snooper.o igmp.o timer.o cache.o utils.o $(SWITCH).o
43	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
44
45test: $(SWITCH).c
46	$(CC) -DTEST $(CFLAGS) $(LDFLAGS) -o $@ $^
47
48clean:
49	rm -f *.o *~ snooper test
50
51%.o: %.c *.h Makefile
52	$(CC) $(CFLAGS) -c -o $@ -fPIC $<
53