Makefile geht nicht

Gast #4030242
Lesenswert?
• ▲
▼
Auf meinem Raspi hab ich:
pi@raspberrypi ~/pwm_stuff/RPIO-master/source/c_pwm $ ls -l
total 96
-rw-r--r-- 1 pi pi  1343 Mar 15  2013 Makefile
-rwxr-xr-x 1 pi pi 29505 Feb 26 14:42 pwm
-rw-r--r-- 1 pi pi 24877 Feb 26 14:45 pwm.c
-rw-r--r-- 1 pi pi  1760 Mar 15  2013 pwm.h
-rw-r--r-- 1 pi pi  7909 Mar 15  2013 pwm_py.c
-rw-r--r-- 1 pi pi 16608 Mar 15  2013 servod.c

Jetzt crunchen:
pi@raspberrypi ~/pwm_stuff/RPIO-master/source/c_pwm $ make
make: *** No rule to make target 'py', needed by 'all'.  Stop.

Warum die Fehlermeldung?



Das ist das makefile:
1
all: pwm py
2

3
pwm:
4
  gcc -Wall -g -O2 -o pwm pwm.c
5

6
py2.6:
7
  mkdir -p build
8
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pwm.c -o build/pwm.o
9
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pwm_py.c -o build/pwm_py.o
10
  gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/pwm.o build/pwm_py.o -o _PWM.so
11
  rm -rf build
12

13
py2.7:
14
  mkdir -p build
15
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pwm.c -o build/pwm.o
16
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pwm_py.c -o build/pwm_py.o
17
  gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/pwm.o build/pwm_py.o -o _PWM.so
18
  rm -rf build
19

20
py3.2:
21
  mkdir -p build
22
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.2mu -c pwm.c -o build/pwm.o
23
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.2mu -c pwm_py.c -o build/pwm_py.o
24
  gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/pwm.o build/pwm_py.o -o _PWM.so
25
  rm -rf build
Gast #4031952
Lesenswert?
• ▲
▼
Mach erst mal das Makefile ein bisschen besser lesbar. z.B. so:
1
PYTHON=python3.2mu   # ... oder halt python2.6 oder python2.7
2

3
GCC_OPTS=-Wall -g -O2
4
GCC_PY_OPTS=-pthread -fno-strict-aliasing -DNDEBUG -fwrapv -Wstrict-prototypes -fPIC -I/usr/include/$(PYTHON)
5
GCC_LINK_OPTS=-pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro
6

7
all: pwm py
8

9
pwm:
10
    gcc $(GCC_OPTS) -o pwm pwm.c
11

12
py:
13
    mkdir -p build
14
    gcc $(GCC_OPTS) $(GCC_PY_OPTS) -c pwm.c -o build/pwm.o
15
    gcc $(GCC_OPTS) $(GCC_PY_OPTS) -c pwm_py.c -o build/pwm_py.o
16
    gcc $(GCC_LINK_OPTS) build/pwm.o build/pwm_py.o -o _PWM.so

> Alles klar.

Das glaub' ich auch nicht.
Warum compilierst du z.B. pwm.c zweimal? (einmal im make target py, 
einmal im target pwm?
Gast #4032211
Lesenswert?
• ▲
▼
>Warum compilierst du z.B. pwm.c zweimal? (einmal im make target py,
>einmal im target pwm?

Da mußte den fragen der das Makefile geschrieben hat...
Kann schon sein, daß die unterschiedlichen Compileroptionen absichtlich 
unterschiedlichen Code erzeugen... das zweite Kompilat wird Teil eines 
.so Datei.

Antwort schreiben

Hinweis: der ursprüngliche Beitrag ist mehr als 6 Monate alt. Bitte hier nur auf die ursprüngliche Frage antworten, für neue Fragen einen neuen Beitrag erstellen.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.