CXX      = g++

SOURCES = huff_heap.cpp huffman.cpp main.cpp
DEPS = $(SOURCES:.cpp=.d)
OBJECTS = $(SOURCES:.cpp=.o)

DEBUG = -g
CXXFLAGS  += $(DEBUG) -Wall -std=c++11
LDFLAGS += $(DEBUG)

all : huffman

$(OBJECTS) : %.o : %.cpp
	$(CXX) -MMD $(CXXFLAGS) -c $< -o $@

huffman: $(OBJECTS)
	$(CXX) $^ -o $@ $(LDFLAGS)

archive :
	tar czvf rendu_$(USER).tar.gz \
		--transform "s-^-Rendu_$(USER)/-" \
		--exclude "*.tar.gz" \
		--exclude "*.o" \
		--exclude "*.d" \
		*

clean:
	@rm -f huffman $(OBJECTS) $(DEPS)

-include $(DEPS)
