Makefile 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9
BINDIR=bin
OBJDIR=obj
SRCDIR=src
INCDIR=include

CC = g++
CWARN = -W -Wall -Wshadow -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized -O

CDBG = -g $(CWARN) -fno-inline
Yoann Pigné's avatar
Yoann Pigné committed
10
CFLAGS = -I$(INCDIR) -O3 
11 12 13 14 15
DFLAGS = -I$(INCDIR) -g $(CWARN) -fno-inline -DDEBUG=1

CTAG = ctags
CTAGFILE = filelist
# src, object and bin files
16 17
OUT_BINARY := netstream-main 
OUT_LIBRARY := libnetstream.a
18 19 20 21

HEADERS = $(INCDIR)/global.h

OBJS = \
22 23
    $(OBJDIR)/netstream-storage.o  \
	$(OBJDIR)/netstream-socket.o \
24 25 26 27 28 29
    $(OBJDIR)/netstream-sender.o \
	$(OBJDIR)/netstream-main.o 
	 
.SECONDARY:

#-- Rules
30 31 32 33 34 35
all : $(OUT_BINARY) $(OUT_LIBRARY)

$(OUT_BINARY) : $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $(OUT_BINARY)

$(OUT_LIBRARY) : $(OBJS)
Yoann Pigné's avatar
Yoann Pigné committed
36
	libtool -static -o $(OUT_LIBRARY)  $(OBJS)
37 38

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
Yoann Pigné's avatar
Yoann Pigné committed
39
	mkdir -p $(OBJDIR)
40 41 42 43 44 45 46 47 48 49 50 51 52 53
	$(CC) $(CFLAGS) -c $? -o $@ 

.PHONY : clean depend fresh

tag :
	find src/*.cpp include/*.h > filelist
	$(CTAG) -L $(CTAGFILE)

clean :
	-rm -f $(OBJDIR)/*.o $(PARSE_C) $(PARSE_H)
	-rm -f $(OBJDIR)/*/*.o $(PARSE_C) $(PARSE_H)
	-rm -f $(SRCDIR)/*.output $(LEX_C)
	-rm -f */*~ *~ core
	-rm -f $(BINDIR)/*
54 55
	-rm -f $(OUT_BINARY)
	-rm -f $(OUT_LIBRARY)
56

57
fresh : clean all