################################################################################ # vlm Makefile # (c)1998 VideoLAN ################################################################################ ################################################################################ # Settings ################################################################################ # # C++ compiler must be used # CC=g++ # # C compiler flags: dependancies # DCFLAGS+=-Wall DCFLAGS+=-MM # # C compiler flags: compilation # CCFLAGS+=-Wall #CCFLAGS+=-fexternal-templates CCFLAGS+=-D_REENTRANT #CCFLAGS+=-O8 # # C compiler flags: linking # LCFLAGS+=-Wall # # Headers paths # INCLUDE+=-I../core/ INCLUDE+=-I. INCLUDE+=-I- # Use the GTK Toolkit and the GTK-- wrapper GTKFLAGS += `gtk-config --cflags` GTKLIBS += `gtk-config --libs` GTKLIBS += -lgdk GTKLIBS += -lgdkmm GTKLIBS += -lgtkmm # # Needed libraries # LIB+=-lpthread #LIB+=-lnspr3 #LIB+=lib/libamsapi.so # # Debugging and profiling # CCFLAGS+=-g #CCFLAGS+=-pg #CCFLAGS+=-g -pg #LIB+=-ldmalloc #LIB+=-lefence ################################################################################# # Files desription ################################################################################# # # Source files # SRC= ../core/cfgfile.cpp \ ../core/composite.cpp \ ../core/log.cpp \ ../core/string.cpp \ ../core/thread.cpp \ vlm.cpp \ vlm_frame.cpp \ vlm_about.cpp \ vlm_console.cpp \ vlm_draw.cpp \ # # Object files # OBJ:=$(SRC:%.cpp=obj/%.o) # # Dependancies # DEP:=$(SRC:%.cpp=dep/%.d) ################################################################################ # Targets definition ################################################################################ # # Build rules # all: vlm clean: rm -Rf obj/* distclean: clean rm -f vls rm -Rf dep/* rm -Rf *.log *.dbg dep: $(DEP) vlm: $(OBJ) @echo "Linking $@..." $(CC) -o $@ $(OBJ) $(CFLAGS) $(LCFLAGS) $(LIB) $(GTKLIBS) chmod 755 $@ $(OBJ): obj/%.o: dep/%.d $(OBJ): obj/%.o: %.cpp @test -d obj/$(dir $*) || mkdir -p obj/$(dir $*) @echo "Compiling $<..." $(CC) $(CFLAGS) $(CCFLAGS) $(GTKFLAGS) $(INCLUDE) -o $@ -c $< $(DEP): Makefile $(DEP): dep/%.d: %.cpp @test -d dep/$(dir $*) || mkdir -p dep/$(dir $*) @echo "Generating dependancies for $<..." @$(SHELL) -ec '$(CC) $(CFLAGS) $(DCFLAGS) $(INCLUDE) $< \ | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \ dep\/$(subst /,\/,$*).d : /g'\'' > $@; \ [ -s $@ ] || rm -f $@' # # Dependancies inclusion # -include $(DEP) ################################################################################ # Notes ################################################################################ # The purpose of the sed command is to make each `.d' file depend on all the # source and header files that the corresponding `.o' file depends on. make then # knows it must regenerate the dependencies whenever any of the source or header # files changes. # Each .d file also depends on the Makefile so that make regenerate the entire # files when the Makefile is modified # # Each .o file of course depends of all the headers it may include thanks to the # automatic dependance computation. # Is also depends on the corresponding .d file so that we are sure it will be # remade each time the dependancies are updated even if the files it depends have # not changed. This is usefull when the Makefile is modified for example. # # At that time, all dependancies are included. Howewer a .d file should only be # included if the corresponding .o needs to be re-made. I don't know how to do # without calling another makefile to build the .d files.