# Locations:
#
PREFIX	= /usr
BIN	= download.front


# Compiler Flags:
#
CFLAGS	= -Wall -O2 -g
CFLAGS	+= `gtk-config --cflags`


# C++ flags:
#
CPPFLAGS	= -D__cplusplus -Dc_plusplus


# Include Directories:
#
INC_DIRS	=


# Libraries & Library Directories:
#
LIBS		= -L../libendeavour2-base -lendeavour2-base
LIBS		+= `gtk-config --libs`
LIB_DIRS	=


# Compilers:
#
CC	= cc
CPP	= c++


# Programs:
#
LS	= ls
LSFLAGS	= -s -h -c --color=auto
RM	= rm
RMFLAGS	= -f


# Source Files List:
#
include Makefile.srclist


# Compile Time Information Output:
#
EXPORT_COMPILETIMEINFO_H	= /bin/echo -n -e "\
\#ifndef COMPILETIMEINFO_H\n\
\#define COMPILETIMEINFO_H\n\
\#define COMPILE_COMPILER\t\"`$(CPP) --version`\"\n\
\#define COMPILE_USER\t\t\"$(USER)\"\n\
\#define COMPILE_LOCATION\t\"`uname -n`\"\n\
\#define COMPILE_DATE\t\t`date +\"%s\"`\n\
\#endif\t/* COMPILETIMEINFO_H */\n"


# Build Rules:
#
OBJ_C	= $(SRC_C:.c=.o)
OBJ_CPP	= $(SRC_CPP:.cpp=.o)
.c.o:
	@echo "Compiling module $*.o"
	@+$(CC) -c $*.c $(INC_DIRS) $(CFLAGS)
.cpp.o:
	@echo "Compiling module $*.o"
	@+$(CPP) -c $*.cpp $(INC_DIRS) $(CFLAGS) $(CPPFLAGS)


$(BIN): config prebuild modules postbuild

config:
	@$(EXPORT_COMPILETIMEINFO_H) > compiletimeinfo.h

modules: $(OBJ_C) $(OBJ_CPP)
	@echo -n "Linking modules..."
	@$(CPP) $(OBJ_C) $(OBJ_CPP) \
        -o $(BIN) $(LIB_DIRS) $(LIBS)
	@echo -n "   "
	@-$(LS) $(LSFLAGS) $(BIN)

prebuild:
	@echo "Building program \"$(BIN)\"..."

postbuild:
	@echo "Build done."

all: $(BIN)


# Install Rules:
#
include Makefile.install.UNIX


# Maintainance and Misc Rules:
#
clean:
	@echo "Cleaning program \"$(BIN)\"..."
	@echo "Deleting all intermediate files..."
	@$(RM) $(RMFLAGS) a.out core *.o compiletimeinfo.h $(BIN)
	@echo "Clean done."
