Makefile : Suppression non désirée des .jpg créés.
Bonsoir à tous!
J'ai lancé des recherches sur google, lu la FAQ du forum et les règles du site et recherché sur le forum sans résultats, je me permets donc de créer un sujet.
Petite présentation : Je suis actuellement étudiant en informatique (ensimag pour ceux qui connaissent) et un projet de Makefile nous a été donné à faire. Nous venons juste de découvrire les makefile donc mes connaissances restent relativement faibles mais je pense avoir compris le principe. Je travaille sous Centos 6.5 64 bits.
But du projet : à partir d'un répertoire source contenant des images .jpg, il nous est demandé de créer une page index.html dans un répertoire /dest qui affiche ces images redimenssionnées.
Le problème : Tout fonctionne, j'ai bien vérifié avec
Code:
makefile dest/index -rRd
sauf qu'au final, j'ai :
Citation:
Successfully remade target file `dest/index.html'.
Removing intermediate files...
rm dest/black_texture_terminal_background.jpg dest/hot-keely-hazell-looking-sexy.jpg dest/images.jpg dest/youm.jpg
Make supprime donc mes images redimenssionnées du dossier /dest ce qui fait qu'en tapant :
Code:
firefox /dest/index.html
Rien n'est affiché puisque les images appellées par index.html ne sont plus dans le dossier /dest.
Ma question : Pourquoi make considère-t-il ces fichiers comme intermédiaires? J'ai cru comprendre qu'en effet, make supprimait les fichiers qu'il avait eu besoin de créer au fur et à mesure de la compilation mais ceux-ci sont explicitement créés par moi-même? Est-il possible de lui demander de conserver ces fichiers ou dois-je changer quelque chose à mon code?
Mon Makefile :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| # Source and destination directories, to be configured here:
SOURCE=~/Pictures
DEST=./dest
IMAGES=${shell cd $(SOURCE) && echo *.jpg}
THUMBS=$(IMAGES:%=$(DEST)/%)
IMAGE_DESC=$(IMAGES:%.jpg=$(DEST)/%.inc)
# TODO
$(DEST)/%.inc: $(DEST)/%.jpg
./generate-img-fragment_make.sh $< > $@
$(DEST)/index.html: $(IMAGE_DESC)
./generate-index.sh --html_head >> $@ ; \
for k in $(IMAGE_DESC) ; do \
./generate-index.sh $$k >> $@ ; \
done ; \
./generate-index.sh --html_tail >> $@ ;
$(DEST)/%.jpg: $(SOURCE)/%.jpg
convert $< -resize 200x200 $@ |
Descriptions des scripts du Makefile
generate-img-fragment_make prend en argument $1 une image.jpg et donne le code html nécessaire.
generate-index.sh donne le head et le tail du html avec --html_head et --html_tail et effectue un simple cat $1 dans les autres cas.
Le verbose complet du make :
Code:
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
[Fitz@localhost squelette-tpl-unix]$ make dest/index.html -rRd
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
Reading makefiles...
Reading makefile `Makefile'...
Updating makefiles....
Considering target file `Makefile'.
Looking for an implicit rule for `Makefile'.
No implicit rule found for `Makefile'.
Finished prerequisites of target file `Makefile'.
No need to remake target `Makefile'.
Updating goal targets....
Considering target file `dest/index.html'.
File `dest/index.html' does not exist.
Considering target file `dest/black_texture_terminal_background.inc'.
File `dest/black_texture_terminal_background.inc' does not exist.
Looking for an implicit rule for `dest/black_texture_terminal_background.inc'.
Trying pattern rule with stem `black_texture_terminal_background'.
Trying implicit prerequisite `dest/black_texture_terminal_background.jpg'.
Trying pattern rule with stem `black_texture_terminal_background'.
Trying implicit prerequisite `dest/black_texture_terminal_background.jpg'.
Looking for a rule with intermediate file `dest/black_texture_terminal_background.jpg'.
Avoiding implicit rule recursion.
Trying pattern rule with stem `black_texture_terminal_background'.
Trying implicit prerequisite `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
Found an implicit rule for `dest/black_texture_terminal_background.inc'.
Considering target file `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
Looking for an implicit rule for `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
No implicit rule found for `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
Finished prerequisites of target file `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
No need to remake target `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
Considering target file `dest/black_texture_terminal_background.jpg'.
File `dest/black_texture_terminal_background.jpg' does not exist.
Pruning file `/home/Fitz/Pictures/black_texture_terminal_background.jpg'.
Finished prerequisites of target file `dest/black_texture_terminal_background.jpg'.
Must remake target `dest/black_texture_terminal_background.jpg'.
convert /home/Fitz/Pictures/black_texture_terminal_background.jpg -resize 200x200 dest/black_texture_terminal_background.jpg
Putting child 0x009425a0 (dest/black_texture_terminal_background.jpg) PID 4126 on the chain.
Live child 0x009425a0 (dest/black_texture_terminal_background.jpg) PID 4126
Reaping winning child 0x009425a0 PID 4126
Removing child 0x009425a0 PID 4126 from chain.
Successfully remade target file `dest/black_texture_terminal_background.jpg'.
Finished prerequisites of target file `dest/black_texture_terminal_background.inc'.
Must remake target `dest/black_texture_terminal_background.inc'.
./generate-img-fragment_make.sh dest/black_texture_terminal_background.jpg > dest/black_texture_terminal_background.inc
Putting child 0x0094e020 (dest/black_texture_terminal_background.inc) PID 4130 on the chain.
Live child 0x0094e020 (dest/black_texture_terminal_background.inc) PID 4130
Reaping winning child 0x0094e020 PID 4130
Removing child 0x0094e020 PID 4130 from chain.
Successfully remade target file `dest/black_texture_terminal_background.inc'.
Considering target file `dest/hot-keely-hazell-looking-sexy.inc'.
File `dest/hot-keely-hazell-looking-sexy.inc' does not exist.
Looking for an implicit rule for `dest/hot-keely-hazell-looking-sexy.inc'.
Trying pattern rule with stem `hot-keely-hazell-looking-sexy'.
Trying implicit prerequisite `dest/hot-keely-hazell-looking-sexy.jpg'.
Trying pattern rule with stem `hot-keely-hazell-looking-sexy'.
Trying implicit prerequisite `dest/hot-keely-hazell-looking-sexy.jpg'.
Looking for a rule with intermediate file `dest/hot-keely-hazell-looking-sexy.jpg'.
Avoiding implicit rule recursion.
Trying pattern rule with stem `hot-keely-hazell-looking-sexy'.
Trying implicit prerequisite `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
Found an implicit rule for `dest/hot-keely-hazell-looking-sexy.inc'.
Considering target file `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
Looking for an implicit rule for `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
No implicit rule found for `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
Finished prerequisites of target file `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
No need to remake target `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
Considering target file `dest/hot-keely-hazell-looking-sexy.jpg'.
File `dest/hot-keely-hazell-looking-sexy.jpg' does not exist.
Pruning file `/home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg'.
Finished prerequisites of target file `dest/hot-keely-hazell-looking-sexy.jpg'.
Must remake target `dest/hot-keely-hazell-looking-sexy.jpg'.
convert /home/Fitz/Pictures/hot-keely-hazell-looking-sexy.jpg -resize 200x200 dest/hot-keely-hazell-looking-sexy.jpg
Putting child 0x0094d910 (dest/hot-keely-hazell-looking-sexy.jpg) PID 4133 on the chain.
Live child 0x0094d910 (dest/hot-keely-hazell-looking-sexy.jpg) PID 4133
Reaping winning child 0x0094d910 PID 4133
Removing child 0x0094d910 PID 4133 from chain.
Successfully remade target file `dest/hot-keely-hazell-looking-sexy.jpg'.
Finished prerequisites of target file `dest/hot-keely-hazell-looking-sexy.inc'.
Must remake target `dest/hot-keely-hazell-looking-sexy.inc'.
./generate-img-fragment_make.sh dest/hot-keely-hazell-looking-sexy.jpg > dest/hot-keely-hazell-looking-sexy.inc
Putting child 0x0094d970 (dest/hot-keely-hazell-looking-sexy.inc) PID 4137 on the chain.
Live child 0x0094d970 (dest/hot-keely-hazell-looking-sexy.inc) PID 4137
Reaping winning child 0x0094d970 PID 4137
Removing child 0x0094d970 PID 4137 from chain.
Successfully remade target file `dest/hot-keely-hazell-looking-sexy.inc'.
Considering target file `dest/images.inc'.
File `dest/images.inc' does not exist.
Looking for an implicit rule for `dest/images.inc'.
Trying pattern rule with stem `images'.
Trying implicit prerequisite `dest/images.jpg'.
Trying pattern rule with stem `images'.
Trying implicit prerequisite `dest/images.jpg'.
Looking for a rule with intermediate file `dest/images.jpg'.
Avoiding implicit rule recursion.
Trying pattern rule with stem `images'.
Trying implicit prerequisite `/home/Fitz/Pictures/images.jpg'.
Found an implicit rule for `dest/images.inc'.
Considering target file `/home/Fitz/Pictures/images.jpg'.
Looking for an implicit rule for `/home/Fitz/Pictures/images.jpg'.
No implicit rule found for `/home/Fitz/Pictures/images.jpg'.
Finished prerequisites of target file `/home/Fitz/Pictures/images.jpg'.
No need to remake target `/home/Fitz/Pictures/images.jpg'.
Considering target file `dest/images.jpg'.
File `dest/images.jpg' does not exist.
Pruning file `/home/Fitz/Pictures/images.jpg'.
Finished prerequisites of target file `dest/images.jpg'.
Must remake target `dest/images.jpg'.
convert /home/Fitz/Pictures/images.jpg -resize 200x200 dest/images.jpg
Putting child 0x0094dd90 (dest/images.jpg) PID 4140 on the chain.
Live child 0x0094dd90 (dest/images.jpg) PID 4140
Reaping winning child 0x0094dd90 PID 4140
Removing child 0x0094dd90 PID 4140 from chain.
Successfully remade target file `dest/images.jpg'.
Finished prerequisites of target file `dest/images.inc'.
Must remake target `dest/images.inc'.
./generate-img-fragment_make.sh dest/images.jpg > dest/images.inc
Putting child 0x009501e0 (dest/images.inc) PID 4144 on the chain.
Live child 0x009501e0 (dest/images.inc) PID 4144
Reaping winning child 0x009501e0 PID 4144
Removing child 0x009501e0 PID 4144 from chain.
Successfully remade target file `dest/images.inc'.
Considering target file `dest/youm.inc'.
File `dest/youm.inc' does not exist.
Looking for an implicit rule for `dest/youm.inc'.
Trying pattern rule with stem `youm'.
Trying implicit prerequisite `dest/youm.jpg'.
Trying pattern rule with stem `youm'.
Trying implicit prerequisite `dest/youm.jpg'.
Looking for a rule with intermediate file `dest/youm.jpg'.
Avoiding implicit rule recursion.
Trying pattern rule with stem `youm'.
Trying implicit prerequisite `/home/Fitz/Pictures/youm.jpg'.
Found an implicit rule for `dest/youm.inc'.
Considering target file `/home/Fitz/Pictures/youm.jpg'.
Looking for an implicit rule for `/home/Fitz/Pictures/youm.jpg'.
No implicit rule found for `/home/Fitz/Pictures/youm.jpg'.
Finished prerequisites of target file `/home/Fitz/Pictures/youm.jpg'.
No need to remake target `/home/Fitz/Pictures/youm.jpg'.
Considering target file `dest/youm.jpg'.
File `dest/youm.jpg' does not exist.
Pruning file `/home/Fitz/Pictures/youm.jpg'.
Finished prerequisites of target file `dest/youm.jpg'.
Must remake target `dest/youm.jpg'.
convert /home/Fitz/Pictures/youm.jpg -resize 200x200 dest/youm.jpg
Putting child 0x00950750 (dest/youm.jpg) PID 4147 on the chain.
Live child 0x00950750 (dest/youm.jpg) PID 4147
Reaping winning child 0x00950750 PID 4147
Removing child 0x00950750 PID 4147 from chain.
Successfully remade target file `dest/youm.jpg'.
Finished prerequisites of target file `dest/youm.inc'.
Must remake target `dest/youm.inc'.
./generate-img-fragment_make.sh dest/youm.jpg > dest/youm.inc
Putting child 0x009502b0 (dest/youm.inc) PID 4151 on the chain.
Live child 0x009502b0 (dest/youm.inc) PID 4151
Reaping winning child 0x009502b0 PID 4151
Removing child 0x009502b0 PID 4151 from chain.
Successfully remade target file `dest/youm.inc'.
Finished prerequisites of target file `dest/index.html'.
Must remake target `dest/index.html'.
./generate-index.sh --html_head >> dest/index.html ; \
for k in ./dest/black_texture_terminal_background.inc ./dest/hot-keely-hazell-looking-sexy.inc ./dest/images.inc ./dest/youm.inc ; do \
./generate-index.sh $k >> dest/index.html ; \
done ; \
./generate-index.sh --html_tail >> dest/index.html ; \
Putting child 0x00942230 (dest/index.html) PID 4155 on the chain.
Live child 0x00942230 (dest/index.html) PID 4155
Reaping winning child 0x00942230 PID 4155
Removing child 0x00942230 PID 4155 from chain.
Successfully remade target file `dest/index.html'.
Removing intermediate files...
rm dest/black_texture_terminal_background.jpg dest/hot-keely-hazell-looking-sexy.jpg dest/images.jpg dest/youm.jpg |
Merci à ceux qui ont eu le courage de me lire et merci pour vos futures questions/réponses/critiques!
Bonne soirée!