Hallo
und vielen Dank für die Hinweise. Genau in diese Richtung möchte ich
gehen!
1.) Verschiedene Softwaremodule befinden sich in verschiedenen
Verzeichnissen. Das Hautpanwendung (main) ebenso.
Ich habe nun in jedem Verzeichnis ein Makefile und eine file .depend
angelegt. Das Makefile sieht folgendermassen aus:
1 | LIBNAME = usbstack
|
2 |
|
3 | # Package definitions
|
4 | PKG_NAME = target
|
5 | DATE = $$(date +%Y%m%d)
|
6 |
|
7 | # Tool definitions
|
8 | CC = arm-elf-gcc
|
9 | LD = arm-elf-ld -v
|
10 | AR = arm-elf-ar
|
11 | AS = arm-elf-as
|
12 | CP = arm-elf-objcopy
|
13 | OD = arm-elf-objdump
|
14 | RM = rm
|
15 | TAR = tar
|
16 |
|
17 | CFLAGS = -I./ -I../ -c -W -Wall -Os -g -DDEBUG -mcpu=arm7tdmi
|
18 | ARFLAGS = -rcs
|
19 |
|
20 | LIBSRCS = usbhw_lpc.c usbcontrol.c usbstdreq.c usbinit.c
|
21 | LIBOBJS = $(LIBSRCS:.c=.o)
|
22 |
|
23 | all: depend lib examples
|
24 |
|
25 | clean:
|
26 | $(RM) -f $(LIBNAME).a $(LIBOBJS) .depend
|
27 | make -C examples clean
|
28 |
|
29 | examples:
|
30 | make -C examples
|
31 |
|
32 | # build lib
|
33 | lib: $(LIBNAME).a
|
34 |
|
35 | $(LIBNAME).a: $(LIBOBJS)
|
36 | $(AR) $(ARFLAGS) $@ $^
|
37 |
|
38 | # Builds release tar file
|
39 | dist: clean
|
40 | cd .. && $(TAR) --exclude={CVS,cvs,.svn} -cvzf $(PKG_NAME)-$(DATE).tar.gz $(PKG_NAME)
|
41 |
|
42 | # recompile if the Makefile changes
|
43 | $(LIBOBJS): Makefile
|
44 |
|
45 | # dependency checking
|
46 | depend: $(LIBSRCS)
|
47 | $(CC) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
48 |
|
49 | # phony targets
|
50 | .PHONY: all clean examples depend
|
51 |
|
52 | -include .depend
|
Im .depend-file ist angegeben:
1 | usbhw_lpc.o: usbhw_lpc.c type.h usbdebug.h usbhw_lpc.h usbapi.h \
|
2 | usbstruct.h
|
3 | usbcontrol.o: usbcontrol.c type.h usbdebug.h usbstruct.h usbapi.h
|
4 | usbstdreq.o: usbstdreq.c type.h usbdebug.h usbstruct.h usbapi.h
|
5 | usbinit.o: usbinit.c type.h usbdebug.h usbapi.h usbstruct.h
|
Beim Aufruf von make erhalte ich allerdings die Meldung:
F:\Ex1_usb\Misc>make
make: *** No rule to make target `usbhw_lpc.c', needed by `depend'.
Stop.
F:\Ecx1_usb\Misc>make depend.
make: *** No rule to make target `depend.'. Stop.
2.) Ich habe das Problem, dass h-files auch in anderen Verzeichnissen
abgelegt werden. Kann man dieses Problem auch irgendwie lösen?
Vielen Dank für Eure Hilfe
Martin
So richtig kompfortabel wäre es, wenn es ein Tool gäbe, das diese
"scheinbare" Routineaufgabe erfüllen kann - obwohl es nun langsam
neugierig werde, wie dies makesfiles funktionieren:)