Tomato 1.23
[tomato.git] / release / src / router / upnp / igd / linux / Makefile
blob3a5529a297349783d9bcb87638267073583b2613
2 # Copyright 2005, Broadcom Corporation
3 # All Rights Reserved.
5 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10 # $Id: Makefile,v 1.8 2005/03/07 08:35:32 kanki Exp $
13 ifeq ($(SRCBASE),)
14 SRCBASE=../../../..
15 endif
17 ifeq ($(PLATFORM), mipsel)
18 export PATH:=/projects/hnd/tools/linux/hndtools-mipsel-linux/bin:${PATH}
19 TARGET_PREFIX = mipsel-linux-
20 CFLAGS += -DMIPS
21 else
22 TARGET_PREFIX =
23 endif
25 CC = $(TARGET_PREFIX)gcc
26 AS = $(TARGET_PREFIX)as
27 AR = $(TARGET_PREFIX)ar
28 LD = $(TARGET_PREFIX)ld
29 CCPP = $(TARGET_PREFIX)g++
30 COMPILER = $(TARGET_PREFIX)g++
31 STRIP = $(TARGET_PREFIX)strip
32 SIZE = $(TARGET_PREFIX)size
34 VPATH.h = .:..:../../include:$(SRCBASE)/include:$(SRCBASE)/router/shared
36 vpath %.c .:..:$(SRCBASE)/shared/netconf
37 vpath %.h $(VPATH.h)
40 ifeq ($(DEBUG),1)
41 CFLAGS += -g -DDEBUG -UNDEBUG -DBCMDBG
42 else
43 CFLAGS += -O2 -DNDEBUG
44 endif
45 CFLAGS += -I$(subst :, -I,$(VPATH.h))
46 CFLAGS += -Wall -Wunused
47 #CFLAGS += --trace-includes
48 OBJDIR=obj
50 # compile in the generic UPNP IGD files.
52 SOURCES = igd.c igd_desc.c wancommon.c wanipc.c ipt.c \
53 layer3.c \
54 x_wanpppconnection.c wanppp.c \
55 mapmgr.c
57 # Add the OS-specific source files.
58 SOURCES += linux_main.c linux_net.c linux_igd.c
61 SOURCES.TEST = test.c shutils.c
63 SOURCES.OBJ := $(SOURCES)
64 SOURCES.OBJ := $(patsubst %.c,$(OBJDIR)/%.o,$(SOURCES.OBJ))
66 TARGET = upnp
67 LIBS = -L../../upnp/linux -L$(SRCBASE)/router/netconf \
68 -L$(SRCBASE)/router/nvram -L$(SRCBASE)/router/shared -lupnp -lnetconf -lnvram -lshared
70 all : $(OBJDIR) $(TARGET)
72 $(OBJDIR):
73 mkdir -p $(OBJDIR)
75 wanipc.c : wanipc.h
77 ipt.c : wanipc.h
79 $(SOURCES.OBJ): upnp.h $(SRCBASE)/include/cyutils.h $(SRCBASE)/include/code_pattern.h
81 $(OBJDIR)/%.o: %.c
82 $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
84 # uncomment BUILD_LIBS if you want this makefile to build the netconf and itables libraries.
85 #BUILD_LIBS=1
87 ifneq ($(BUILD_LIBS),)
89 $(TARGET) :: libnetconf.so
91 $(TARGET) :: $(SRCBASE)/router/iptables/libiptables.a
93 $(TARGET) :: $(SRCBASE)/router/nvram/libnvram.a
95 $(SRCBASE)/router/iptables/libiptables.a : FORCE
96 $(MAKE) -C $(SRCBASE)/router/iptables PLATFORM=x86 CC=$(CC) LD=$(LD) SRCBASE=../.. TOP=..
97 $(SRCBASE)/router/nvram/libnvram.a : FORCE
98 $(MAKE) -C $(SRCBASE)/router/nvram PLATFORM=x86 CC=$(CC) LD=$(LD) SRCBASE=../.. TOP=..
100 $(SRCBASE)/router/netconf/libnetconf.so : $(SRCBASE)/router/iptables/libiptables.a FORCE
101 $(MAKE) -C $(SRCBASE)/router/netconf DEBUG=1 PLATFORM=x86 CC=$(CC) LD=$(LD) SRCBASE=../.. TOP=..
103 libnetconf.so : $(SRCBASE)/router/netconf/libnetconf.so
104 # cp $(SRCBASE)/router/netconf/libnetconf.so /router/usr/lib/
106 endif
109 ../../upnp/linux/libupnp.a : FORCE
110 $(MAKE) -C ../../upnp/linux DEBUG=$(DEBUG) PLATFORM=x86 CC=$(CC) LD=$(LD) VENDOR=$(VENDOR)
112 $(TARGET) :: ../../upnp/linux/libupnp.a $(SOURCES.OBJ)
113 $(CC) -o $(TARGET) $(SOURCES.OBJ) $(LIBS)
114 ifneq ($(DEBUG),1)
115 $(STRIP) $(TARGET)
116 endif
117 $(SIZE) $(TARGET)
119 clean:
120 rm -rf obj
121 rm -f upnp
123 fptest: fptest.o
124 $(CC) -o fptest fptest.o $(LIBS)
126 btest: btest.o
127 $(CC) -o btest btest.o
129 FORCE:
131 .PHONY: FORCE clean libs