-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile-rules
121 lines (98 loc) · 4.11 KB
/
Makefile-rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#=======================================================================
#//! \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
########################################################################