Makefile 1.74 KB
Newer Older
Jondy Zhao's avatar
Jondy Zhao committed
1 2 3 4 5 6 7 8
PREFIX = /usr/local

CDEBUGFLAGS = -Os -g -Wall

DEFINES = $(PLATFORM_DEFINES)

CFLAGS = $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES)

9
LDLIBS = -lrt
Jondy Zhao's avatar
Jondy Zhao committed
10 11

SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \
12
       route.c xroute.c message.c resend.c configuration.c local.c
Jondy Zhao's avatar
Jondy Zhao committed
13 14

OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
15 16 17 18 19 20 21 22
       route.o xroute.o message.o resend.o configuration.o local.o

KERNEL_SOUCES = kernel_netlink.c kernel_socket.c

ifneq "$(WINVER)" ""

SRCS += cyginet.c
OBJS += cyginet.o
23
LDLIBS +=  -liphlpapi -lws2_32 -lwlanapi -lole32 -lsetupapi
24 25 26
KERNEL_SOUCES += kernel_cygwin.c

ifeq "$(WINVER)" "XP"
27
CFLAGS += -D_WIN32_WINNT=0x0503
28 29 30
endif

ifeq "$(WINVER)" "VISTA"
31
CLFAGS += -D_WIN32_WINNT=0x0600
32 33 34
endif

endif
Jondy Zhao's avatar
Jondy Zhao committed
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

babeld: $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)

.SUFFIXES: .man .html

.man.html:
	rman -f html $< | \
	sed -e "s|<a href='babeld.8'|<a href=\"babeld.html\"|" \
            -e "s|<a href='\\(ahcp[-a-z]*\\).8'|<a href=\"../ahcp/\1.html\"|" \
	    -e "s|<a href='[^']*8'>\\(.*(8)\\)</a>|\1|" \
	> $@

babeld.html: babeld.man

.PHONY: all install install.minimal uninstall clean

all: babeld babeld.man

install.minimal: babeld
	-rm -f $(TARGET)$(PREFIX)/bin/babeld
	mkdir -p $(TARGET)$(PREFIX)/bin
	cp -f babeld $(TARGET)$(PREFIX)/bin

install: install.minimal all
	mkdir -p $(TARGET)$(PREFIX)/man/man8
	cp -f babeld.man $(TARGET)$(PREFIX)/man/man8/babeld.8

uninstall:
	-rm -f $(TARGET)$(PREFIX)/bin/babeld
	-rm -f $(TARGET)$(PREFIX)/man/man8/babeld.8

clean:
	-rm -f babeld babeld.html *.o *~ core TAGS gmon.out

70
kernel.o: $(KERNEL_SOURCES)
71 72 73 74 75

# Usage: ./testc.exe
# Verify most of the functions in the cyginet.c
testc.exe: cyginet.c
	$(CC) $(CFLAGS) $(LDFLAGS) -DTEST_CYGINET -o $@ $< $(LDLIBS)