1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1998. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Makefiles |
---|
10 | |
---|
11 | @section Makefiles Used During The BSP Building Process |
---|
12 | |
---|
13 | There's a makefile template in each directory of a BSP. They are called |
---|
14 | "makefile.in" and are processed when building RTEMS for a given BSP. One |
---|
15 | should specify the needed files and directories before the building |
---|
16 | process. |
---|
17 | |
---|
18 | @itemize @bullet |
---|
19 | |
---|
20 | @item the makefile.in at the BSP root specifies which folders have to be |
---|
21 | included. For instance, |
---|
22 | |
---|
23 | @item We only build the networking device driver if HAS_NETWORKING was defined |
---|
24 | |
---|
25 | @example |
---|
26 | NETWORKING_DRIVER_yes_V = network |
---|
27 | NETWORKING_DRIVER = $(NETWORKING_DRIVER_$(HAS_NETWORKING)_V) |
---|
28 | |
---|
29 | [...] |
---|
30 | |
---|
31 | SUB_DIRS=include start340 startup clock console timer \ |
---|
32 | $(NETWORKING_DRIVER) wrapup |
---|
33 | @end example |
---|
34 | |
---|
35 | states that all the directories have to be processed, except for the |
---|
36 | network directory which is included only if the user asked for it when |
---|
37 | building RTEMS. |
---|
38 | |
---|
39 | @item the makefile.in in each driver directory. It lists the files to be |
---|
40 | included in the driver, so don't forget to add the reference to a new file |
---|
41 | in the makefile.in of a given driver when it is created! |
---|
42 | |
---|
43 | @end itemize |
---|
44 | |
---|
45 | |
---|
46 | Rem : the makefile.in files are ONLY processed during the configure |
---|
47 | process of a RTEMS build. It means that, when you're working on the design |
---|
48 | of your BSP, and that you're adding a file to a folder and to the |
---|
49 | corresponding makefile.in, it will not be take n into account! You have to |
---|
50 | run configure again or modify the makefile (result of the makefile.in |
---|
51 | process, usually in your <the RTEMS build |
---|
52 | directory>/c/src/lib/libbsp/<your BSP family>/<your BSP>/<your driver> |
---|
53 | directory) by hand. |
---|
54 | |
---|
55 | @section Makefiles Used Both During The BSP Design and its Use |
---|
56 | |
---|
57 | A BSP must go with his configuration file. The configuration files can be |
---|
58 | found under $RTEMS_ROOT/c/make/custom. The configuration file is taken |
---|
59 | into account when building one's application using the template makefiles |
---|
60 | ($RTEMS_ROOT/c/make/templates), whic h is strongly advised. There are |
---|
61 | templates for calling recursively the makefiles in the directories beneath |
---|
62 | the current one, building a library or an executable. |
---|
63 | |
---|
64 | The following is a hevaily commented version of the make customization |
---|
65 | file for the gen68340 BSP. It can be found in the $RTEMS_ROOT/make/custom |
---|
66 | directory. |
---|
67 | |
---|
68 | @example |
---|
69 | |
---|
70 | # The RTEMS CPU Family and Model |
---|
71 | RTEMS_CPU=m68k |
---|
72 | RTEMS_CPU_MODEL=mcpu32 |
---|
73 | |
---|
74 | include $(RTEMS_ROOT)/make/custom/default.cfg |
---|
75 | |
---|
76 | # The name of the BSP directory used for the actual source code. |
---|
77 | # This allows for build variants of the same BSP source. |
---|
78 | RTEMS_BSP_FAMILY=gen68340 |
---|
79 | |
---|
80 | # CPU flag to pass to GCC |
---|
81 | CPU_CFLAGS = -mcpu32 |
---|
82 | |
---|
83 | # optimisation flag to pass to GCC |
---|
84 | CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer |
---|
85 | |
---|
86 | # The name of the start file to be linked with. This file is the first |
---|
87 | # part of the BSP which executes. |
---|
88 | START_BASE=start340 |
---|
89 | |
---|
90 | [...] |
---|
91 | |
---|
92 | # This make-exe macro is used in template makefiles to build the |
---|
93 | # final executable. Any other commands to follow, just as using |
---|
94 | # objcopy to build a PROM image or converting the executable to binary. |
---|
95 | |
---|
96 | ifeq ($(RTEMS_USE_GCC272),yes) |
---|
97 | # This has rules to link an application if an older version of GCC is |
---|
98 | # to be used with this BSP. It is not required for a BSP to support |
---|
99 | # older versions of GCC. This option is supported in some of the |
---|
100 | # BSPs which already had this support. |
---|
101 | [...] |
---|
102 | else |
---|
103 | # This has rules to link an application using gcc 2.8 or newer or any |
---|
104 | # egcs version. All BSPs should support this. This version is required |
---|
105 | # to support GNAT/RTEMS. |
---|
106 | define make-exe |
---|
107 | $(CC) $(CFLAGS) $(CFLAGS_LD) -o $(basename $@@).exe $(LINK_OBJS) |
---|
108 | $(NM) -g -n $(basename $@@).exe > $(basename $@@).num |
---|
109 | $(SIZE) $(basename $@@).exe |
---|
110 | endif |
---|
111 | @end example |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | What you have to do: |
---|
116 | |
---|
117 | @itemize @bullet |
---|
118 | |
---|
119 | @item copy any .cfg file to <your BSP>.cfg |
---|
120 | |
---|
121 | @item modify RTEMS_CPU, TARGET_ARCH, RTEMS_CPU_MODEL, RTEMS_BSP_FAMILY, |
---|
122 | RTEMS_BSP, CPU_CFLAGS, START_BASE accordingly. |
---|
123 | |
---|
124 | @end itemize |
---|
125 | |
---|
126 | |
---|