Acte 1 :

je regarde ce que sortent les 2 lignes suivantes :
ABS_AVERSIVE_DIR:=$(shell cd $(AVERSIVE_DIR) ; pwd)
ABS_PROJECT_DIR:=$(shell pwd)

j utilise un print du genre :
   @echo ABS_AVERSIVE_DIR =  $(ABS_AVERSIVE_DIR)
   @echo ABS_PROJECT_DIR =  $(ABS_PROJECT_DIR)


j'obtiens :

sous cygwin :
> ABS_AVERSIVE_DIR = /cygdrive/d/projets/avr/aversive
> ABS_PROJECT_DIR = /cygdrive/d/projets/avr/aversive/modules/comm/uart/test

sous dos :
> ABS_AVERSIVE_DIR = /d/projets/avr/aversive
> ABS_PROJECT_DIR = D:\projetsvrversive\modulesomm\uart   est


cygwin fait sa sauce, tant pis, on a pass besoin de faire fonctionner sous cygwin (recompil de avr-gcc et consorts fonctionnera). pour le dos, c'est très bizarre, le pwd renvoie un path formaté différamment dans les 2 cas!! en plus les \ sont interpretes comme caracteres d echappement et mettent le bronx un peu partout dans la suite du makefile
(cela arriverait il aussi sous linux avec un path contenant des espaces ?)


Acte 2 :

après pas mal de tests, je remarque des différences en executant le pwd ou pwd.exe (qui renvoie pourtant au même fichier !) il doit executer dans un contexte différent si on ajoute .exe : (shell dos)

D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c 'cd . ; pwd.exe'
D:\projets\avr\aversive_head\modules\comm\uart\test

D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c 'cd . ; pwd'
/d/projets/avr/aversive_head/modules/comm/uart/test



Acte 3 :


je change la ligne :
ABS_PROJECT_DIR:=$(shell pwd)
en :
ABS_PROJECT_DIR:=$(shell cd . ; pwd)

les variables sortent comme ca :
> ABS_AVERSIVE_DIR = /d/projets/avr/aversive
> ABS_PROJECT_DIR = /d/projets/avr/aversive/modules/comm/uart/test


deja un net progres : on a le meme format. Le pourquoi est assez inexpliqué. probablement le make execute t il le pwd dans un contexte différent
(sh ou dos)

manque de bol, le reste du makefile ne fonctionne quand meme pas.


Acte 4 :

Probleme : Avr-gcc et autres ne prennent en compte que les chemins du type dos natif (bizarre aussi ) :


D:\projets\avr\aversive\modules\comm\uart\test>sh -c "avr-gcc -M -g -O3 -Wall -W strict-prototypes -I. -I/d/projets/avr/aversive/include -I/d/projets/avr/aversiv e/modules -I/d/projets/avr/aversive/modules/base/utils -I/d/projets/avr/aversive /modules/base/wait -I/d/projets/avr/aversive/modules/base/list -std=gnu99 -funsi gned-char -funsigned-bitfields -fpack-struct -fshort-enums -mmcu=atmega128 main.
c"
# 1 "D:\\projets\\avr\\aversive\\modules\\comm\\uart\\test//"
main.o: main.c \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/stdio.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/inttypes.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/stdint.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/include/stdarg.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/include/stddef.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/io.h \
c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/sfr_defs.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/iom128.h \
c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/portpins.h \
 c:/winavr/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/pgmspace.h




gcc ne prend pas cettte forme pour le fichier d'entrée :

marche pas :
D:\projets\avr\aversive\modules\comm\uart\test> avr-gcc -c -g -O3 -Wall -Wstrict-prototypes -I. /d/projets/avr/aversive/modules/comm/uart/test/main.c -o compiler_files/main.avr.o avr-gcc: /d/projets/avr/aversive/modules/comm/uart/test/main.c: No such file or
directory

marche pas :
D:\projets\avr\aversive\modules\comm\uart\test>avr-gcc -c -g -O3 -Wall -Wstrict -prototypes -I. d:/projets/avr/aversive/modules/comm/uart/test/main.c -o compile
r_files/main.avr.o

marche :
D:\projets\avr\aversive\modules\comm\uart\test>sh -c "avr-gcc -c -g -O3 -Wall - Wstrict-prototypes -I. /d/projets/avr/aversive/modules/comm/uart/test/main.c -o
compiler_files/main.avr.o"



on dirait que gcc depend fortement du contexte dans lequel il est executé (dos ou sh), comme pwd



Acte 5 :

j ai fait un tet pour convertir dans le format accepté par gcc :  c:/..../

ABS_AVERSIVE_DIR:=$(shell cd $(AVERSIVE_DIR) ; pwd.exe | sed 's_\\\\_/_g')
ABS_PROJECT_DIR:=$(shell cd . ;  pwd.exe | sed 's_\\\\_/_g')


le makefile arrive au bout sans encombre !!

comment ca, de la bidouille ?? bon OK, d'accord...

Acte 6 :

et si on essayait de faire "sh -c make" au lieu de "make"
ben non , ca ne donne rien (voir PJ)
par contre, il y a quelques différences, genre la facon dont le sous-make est appelé (avec un .exe sous sh seulement !!)

Conclusion :

- le make executerait semble t il les sous programmes dans des environnement différents selon pas mal de cas. il faudrait pouvoir forcer les programmes appelés a s'exec sous sh
- l'environnement fait toute la différence (rien a voir avec l'écologie)


on peut faire quoi ?






D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c make
ABS_AVERSIVE_DIR = /d/projets/avr/aversive_head
ABS_PROJECT_DIR = /d/projets/avr/aversive_head/modules/comm/uart/test
Generating compiler_files/main.avr.d
ABS_AVERSIVE_DIR = /d/projets/avr/aversive_head
ABS_PROJECT_DIR = /d/projets/avr/aversive_head/modules/comm/uart/test
avr-gcc (GCC) 3.4.3
Copyright (C) 2004 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.


Size before:
   text    data     bss     dec     hex filename
   4994      22      36    5052    13bc main.elf


Processing MD5:
db61


------ Compiling Module: comm/uart
c:/winavr/utils/bin/make.exe VPATH=/d/projets/avr/aversive_head/modules/comm/uar
t -f ../../../../modules/comm/uart/Makefile
make.exe[1]: *** No rule to make target `compiler_files/uart0_dev_io.avr.o', nee
ded by `compiler_files/uart.avr.a'.  Stop.
make.exe[1]: Entering directory `D:/projets/avr/aversive_head/modules/comm/uart/
test'
make.exe[1]: Leaving directory `D:/projets/avr/aversive_head/modules/comm/uart/t
est'
make.exe: *** [comm/uart] Error 2

D:\projets\avr\aversive_head\modules\comm\uart\test>make
ABS_AVERSIVE_DIR = /d/projets/avr/aversive_head
ABS_PROJECT_DIR = /d/projets/avr/aversive_head/modules/comm/uart/test
Generating compiler_files/main.avr.d
ABS_AVERSIVE_DIR = /d/projets/avr/aversive_head
ABS_PROJECT_DIR = /d/projets/avr/aversive_head/modules/comm/uart/test
avr-gcc (GCC) 3.4.3
Copyright (C) 2004 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.


Size before:
   text    data     bss     dec     hex filename
   4994      22      36    5052    13bc main.elf


Processing MD5:
db61


------ Compiling Module: comm/uart
make VPATH=/d/projets/avr/aversive_head/modules/comm/uart -f ../../../../modules
/comm/uart/Makefile
make[1]: *** No rule to make target `compiler_files/uart0_dev_io.avr.o', needed
by `compiler_files/uart.avr.a'.  Stop.
make[1]: Entering directory `D:/projets/avr/aversive_head/modules/comm/uart/test
'
make[1]: Leaving directory `D:/projets/avr/aversive_head/modules/comm/uart/test'

make: *** [comm/uart] Error 2

D:\projets\avr\aversive_head\modules\comm\uart\test>
D:\projets\avr\aversive_head\modules\comm\uart\test>avr-gcc -c -g  -O3 -Wall -Ws
trict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/avr/ave
rsive_head/modules -Id:/projets/avr/aversive_head/modules/comm/uart -Id:/projets
/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/modules/ba
se/utils -Id:/projets/avr/aversive_head/modules/base/wait -Id:/projets/avr/avers
ive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfields -fpa
ck-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.avr.lst
 D:/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_files/ma
in.avr.o
In file included from D:/projets/avr/aversive_head/modules/comm/uart/test/main.c
:22:
d:/projets/avr/aversive_head/modules/base/wait/wait.h:22:2: warning: #warning "T
his include file is deprecated, please use <aversive/wait.h>"
D:/projets/avr/aversive_head/modules/comm/uart/test/main.c: In function `main':
D:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: warning: passing
arg 1 of `fdevopen' from incompatible pointer type

D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c "avr-gcc -c -g  -O3 -W
all -Wstrict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/
avr/aversive_head/modules -Id:/projets/avr/aversive_head/modules/comm/uart -Id:/
projets/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/mod
ules/base/utils -Id:/projets/avr/aversive_head/modules/base/wait -Id:/projets/av
r/aversive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfiel
ds -fpack-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.
avr.lst D:/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_f
iles/main.avr.o"
In file included from D:/projets/avr/aversive_head/modules/comm/uart/test/main.c
:22:
d:/projets/avr/aversive_head/modules/base/wait/wait.h:22:2: warning: #warning "T
his include file is deprecated, please use <aversive/wait.h>"
D:/projets/avr/aversive_head/modules/comm/uart/test/main.c: In function `main':
D:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: warning: passing
arg 1 of `fdevopen' from incompatible pointer type

D:\projets\avr\aversive_head\modules\comm\uart\test>avr-gcc -c -g  -O3 -Wall -Ws
trict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/avr/ave
rsive_head/modules -Id:/projets/avr/aversive_head/modules/comm/uart -Id:/projets
/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/modules/ba
se/utils -Id:/projets/avr/aversive_head/modules/base/wait -Id:/projets/avr/avers
ive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfields -fpa
ck-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.avr.lst
 /d/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_files/ma
in.avr.o
avr-gcc: /d/projets/avr/aversive_head/modules/comm/uart/test/main.c: No such fil
e or directory
avr-gcc: no input files

D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c "avr-gcc -c -g  -O3 -W
all -Wstrict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/
avr/aversive_head/modules -Id:/projets/avr/aversive_head/modules/comm/uart -Id:/
projets/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/mod
ules/base/utils -Id:/projets/avr/aversive_head/modules/base/wait -Id:/projets/av
r/aversive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfiel
ds -fpack-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.
avr.lst /d/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_f
iles/main.avr.o"
In file included from d:/projets/avr/aversive_head/modules/comm/uart/test/main.c
:22:
d:/projets/avr/aversive_head/modules/base/wait/wait.h:22:2: warning: #warning "T
his include file is deprecated, please use <aversive/wait.h>"
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c: In function `main':
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: warning: passing
arg 1 of `fdevopen' from incompatible pointer type

D:\projets\avr\aversive_head\modules\comm\uart\test>avr-gcc -c -g  -O3 -Wall -Ws
trict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/avr/ave
rsive_head/modules -I/d/projets/avr/aversive_head/modules/comm/uart -Id:/projets
/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/modules/ba
se/utils -I/d/projets/avr/aversive_head/modules/base/wait -Id:/projets/avr/avers
ive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfields -fpa
ck-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.avr.lst
 d:/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_files/ma
in.avr.o
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:21:18: uart.h: No suc
h file or directory
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:22:18: wait.h: No suc
h file or directory
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c: In function `main':
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:43: warning: implicit
 declaration of function `uart_init'
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:46: warning: implicit
 declaration of function `sei'
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:50: warning: implicit
 declaration of function `uart0_send'
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:52: warning: implicit
 declaration of function `wait_ms'
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: error: `uart0_dev
_send' undeclared (first use in this function)
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: error: (Each unde
clared identifier is reported only once
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: error: for each f
unction it appears in.)

D:\projets\avr\aversive_head\modules\comm\uart\test>sh -c "avr-gcc -c -g  -O3 -W
all -Wstrict-prototypes -I. -Id:/projets/avr/aversive_head/include -Id:/projets/
avr/aversive_head/modules -I/d/projets/avr/aversive_head/modules/comm/uart -Id:/
projets/avr/aversive_head/modules/base/cirbuf -Id:/projets/avr/aversive_head/mod
ules/base/utils -I/d/projets/avr/aversive_head/modules/base/wait -Id:/projets/av
r/aversive_head/modules/base/list  -std=gnu99 -funsigned-char -funsigned-bitfiel
ds -fpack-struct -fshort-enums -mmcu=atmega128  -Wa,-adhlns=compiler_files/main.
avr.lst d:/projets/avr/aversive_head/modules/comm/uart/test/main.c -o compiler_f
iles/main.avr.o"
In file included from d:/projets/avr/aversive_head/modules/comm/uart/test/main.c
:22:
d:/projets/avr/aversive_head/modules/base/wait/wait.h:22:2: warning: #warning "T
his include file is deprecated, please use <aversive/wait.h>"
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c: In function `main':
d:/projets/avr/aversive_head/modules/comm/uart/test/main.c:59: warning: passing
arg 1 of `fdevopen' from incompatible pointer type

D:\projets\avr\aversive_head\modules\comm\uart\test>
_______________________________________________
Avr-list mailing list
Avr-list@droids-corp.org
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog

Répondre à