Makefile 1.79 KB
Newer Older
Benoit Steiner's avatar
Benoit Steiner committed
1 2 3
# Makefile for VideoLAN bridge program
# Benoit Steiner, VIA, ECP, <benny@via.ecp.fr>

Benoit Steiner's avatar
Benoit Steiner committed
4

Benoit Steiner's avatar
Benoit Steiner committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18
############ Beginning of the configuration section ############

# Use the GNU C compiler
CC = gcc
# Use checker compiler
#CC = checkercc

# Compile debugging version
CFLAGS += -DDEBUG

# Debug with the debugger
CFLAGS += -g

# Profile with gprof. Don't strip the executable file !
Benoit Steiner's avatar
Benoit Steiner committed
19
#CFLAGS += -pg
Benoit Steiner's avatar
Benoit Steiner committed
20 21

# Compiler parameters style
Benoit Steiner's avatar
Benoit Steiner committed
22 23
CFLAGS += -Wall
#CFLAGS += -O6
Benoit Steiner's avatar
Benoit Steiner committed
24
CFLAGS += -static
Benoit Steiner's avatar
Benoit Steiner committed
25 26 27 28

# To generate the dependencies
DFLAGS += -MM
SHELL = /bin/sh
Benoit Steiner's avatar
Benoit Steiner committed
29 30

# Use threads
Benoit Steiner's avatar
Benoit Steiner committed
31
#CFLAGS += -D_REENTRANT
Benoit Steiner's avatar
Benoit Steiner committed
32 33 34
LIB += -lpthread

# Use electric fence to detect illegal memory access
Benoit Steiner's avatar
Benoit Steiner committed
35
#LIB += -lefence
Benoit Steiner's avatar
Benoit Steiner committed
36 37 38

# Use dmalloc to detect memory leaks
#LIB += -ldmalloc
Benoit Steiner's avatar
Benoit Steiner committed
39 40

# Use ccmalloc to check memory use
Benoit Steiner's avatar
Benoit Steiner committed
41
#LIB += -lccmalloc -ldl
Benoit Steiner's avatar
Benoit Steiner committed
42 43


Benoit Steiner's avatar
Benoit Steiner committed
44
############ Beginning of the files description section ############
Benoit Steiner's avatar
Benoit Steiner committed
45 46

OBJ = \
Benoit Steiner's avatar
Benoit Steiner committed
47
  vlanbridge.o \
Benoit Steiner's avatar
Benoit Steiner committed
48 49 50 51
  manager.o \
  listener.o \
  sender.o \
  performer.o \
Benoit Steiner's avatar
Benoit Steiner committed
52 53
  admin.o \
  command.o \
Benoit Steiner's avatar
Benoit Steiner committed
54 55 56 57 58 59 60 61 62
  log.o \
  fifo.o \
  base.o \
  signal.o \
  pinger.o \
  gratuitous.o \
  route.o \
  arp.o \
  connect.o \
Benoit Steiner's avatar
Benoit Steiner committed
63
  cfgfile.o \
Benoit Steiner's avatar
Benoit Steiner committed
64
  network.o \
Benoit Steiner's avatar
Benoit Steiner committed
65
  convert.o
Benoit Steiner's avatar
Benoit Steiner committed
66 67 68 69 70 71 72 73 74

SRC := $(OBJ:%.o=%.c)

DEP := $(OBJ:%.o=dep/%.d)


############ Beginning of the target definition section ############

all:		VLANbridge
Benoit Steiner's avatar
Benoit Steiner committed
75 76

VLANbridge:	$(OBJ)
Benoit Steiner's avatar
Benoit Steiner committed
77
		$(CC) -o $@ $(OBJ) $(LDFLAGS) $(CFLAGS) $(LIB)
Benoit Steiner's avatar
Benoit Steiner committed
78 79
	        chmod 755 $@

Benoit Steiner's avatar
Benoit Steiner committed
80 81 82 83 84 85 86 87 88 89
$(DEP):		dep/%.d: %.c
		@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
		@echo "Generating dependancies for $*.c"
	        @$(SHELL) -ec '$(CC) $(DFLAGS) $(CFLAGS) $< \
                | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
                dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
                [ -s $@ ] || rm -f $@'

$(OBJ):		%.o: dep/%.d

Benoit Steiner's avatar
Benoit Steiner committed
90
clean:
Benoit Steiner's avatar
Benoit Steiner committed
91 92 93 94 95 96
	        rm -f $(OBJ)

distclean:	clean
		rm -f VLANbridge   
		rm -Rf dep/
		rm -Rf *.o *.log *.dbg
Benoit Steiner's avatar
Benoit Steiner committed
97
		rm -Rf *~ \#* 
Benoit Steiner's avatar
Benoit Steiner committed
98