MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Guide de l'utilisateur Page 113

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 386
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 112
Template Makefiles
3-31
You can use pattern matching expressions to make the dependency rules more
general. For example, using GNU Make you could have replaced the two
"file1.o: file1.c"and"file2.o: file2.c" rules with the single rule:
%.o : %.c
cc c $<
The $< is a special macro that equates to the dependency file (i.e., file1.c or
file2.c). Thus, using macros and the “%” pattern matching character, the
aboveexamplecanbereducedto:
SRCS = file1.c file2.c
OBJS = $(SRCS:.c=.o)
test: $(OBJS)
cc o $@ $(OBJS)
%.o : %.c
cc c $<
This example generates the list of objects (OBJS) from the list of sources (SRCS)
by using the string substitution feature for macro expansion. It replaces the
source file extension (
.c)withtheobjectfileextension(.o). This example also
generalized the build rule for the program,
test,tousethe“$@” special macro
that equates to the name of the current dependency target, in this case
test.
Vue de la page 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 385 386

Commentaires sur ces manuels

Pas de commentaire