#=======================================================================
#//! \file
#//! \section common_makefile_rules_general General file information
#//!   \author    Dirk Osswald 
#//!   \date      2006-12-21
#//!  
#//! \brief  
#//!   Makefile with common rules for generating files (with gcc) 
#//!
#//!   This Makefile is intended to be included by other makefiles and
#//!   contains common rules for use with the gcc (GNU compiler collection)
#//!
#//! \section common_makefile_rules_variables Makefile variables
#//!   This makefile relies on the following variables beeing set:
#//!   - SRCDIR                - directory for source files like e.g. \c "." or \c "src"
#//!   - OBJDIR                - directory for object files like e.g. \c "obj"
#//!   - CC                    - name of C compiler (with path if not in PATH)
#//!   - CPPC                  - name of C++ compiler (with path if not in PATH)
#//!   - ALL_CFLAGS            - all options for compiling c files
#//!   - ALL_CPPFLAGS          - all options for compiling c++ files
#//!   - ALL_ASFLAGS           - all options for assembling .S files
#//!   - ALL_IFLAGS            - all options for generationg preprocessed sources
#//!
#//! \section common_makefile_rules_targets Makefile targets
#//!   - \b \c rules_clean  : clean up generated files in ${OBJDIR} and ${DEPDIR}
#//!   - generic pattern rules for generating e.g. %.o from %.c|%.cpp|%.S ...
#//!   
#//! \section common_makefile_rules_links Links
#//!   - The online documentation for \c gnu \c make can be found at
#//!     <a href="http://www.gnu.org/software/make/manual/make.html">
#//!     http://www.gnu.org/software/make/manual/make.html</a>
#//!  
#//! \section common_makefile_rules_copyright Copyright
#//!
#//!  Copyright (c) 2006 SCHUNK GmbH & Co. KG
#//!
#//!  <HR>
#//!  \internal
#//!
#//!    \subsection common_makefile_rules_details SVN related, detailed file specific information:
#//!      $LastChangedBy: Osswald2 $
#//!      $LastChangedDate: 2009-03-18 09:39:27 +0100 (Mi, 18 Mrz 2009) $
#//!      \par SVN file revision:
#//!        $Id: Makefile-rules 4191 2009-03-18 08:39:27Z Osswald2 $
#//!
#//!  \subsection common_makefile_rules_changelog Changelog of this file:
#//!      \include Makefile-rules.log
#//!
#=======================================================================
#//! \cond ignore_me   doxygen cannot parse Makefiles, so just ignore it


########################################################################
# first some variables

#
########################################################################


########################################################################
# functions

#
########################################################################


########################################################################
# Generic rules:

# Compiling:
${OBJDIR}/%.o: ${SRCDIR}/%.c
	${CC} -c ${ALL_CFLAGS}  $<  -o $@ 

# Compile: create assembler files from C source files.
${OBJDIR}/%.s : ${SRCDIR}/%.c
	$(CC) -S $(ALL_CFLAGS)  $<  -o $@

# Compile: 
${OBJDIR}/%.o : ${SRCDIR}/%.cpp
	$(CPPC) -c $(ALL_CPPFLAGS)  $<  -o $@

# Compile: create assembler files from C++ source files.
${OBJDIR}/%.s : ${SRCDIR}/%.cpp
	$(CPPC) -S $(ALL_CPPFLAGS)  $<  -o $@


# Assemble: create object files from assembler source files.
$(OBJDIR)/%.o : ${SRCDIR}/%.S
	$(CC) -c $(ALL_ASFLAGS) $< -o $@

# Create preprocessed source for use in sending a bug report.
${OBJDIR}/%.i : ${SRCDIR}/%.c
	$(CC) -E $(ALL_IFLAGS) $< -o $@ 

#----------------------------

.PHONY: rules_clean
rules_clean:
	rm -f ${OBJDIR}/*.o   ${DEPDIR}/*

#
########################################################################


########################################################################
#
# Create object files directory
$(shell mkdir $(OBJDIR) 2>/dev/null)

#
########################################################################


#-----------------------------------------------------------------------
# emacs settings:
# Local Variables:
# mode: Makefile
# End:
#-----------------------------------------------------------------------
#//! \endcond
########################################################################
