source: rtems/c/src/configure.ac @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3
4AC_PREREQ([2.69])
5AC_INIT([rtems-c-src],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
6AC_CONFIG_SRCDIR([libchip])
7RTEMS_TOP(../..)
8RTEMS_SOURCE_TOP
9RTEMS_BUILD_TOP
10
11RTEMS_ENABLE_CXX
12RTEMS_ENABLE_NETWORKING
13
14RTEMS_CANONICAL_TARGET_CPU
15
16AM_INIT_AUTOMAKE([no-define subdir-objects no-exeext foreign 1.12.2])
17AM_MAINTAINER_MODE
18
19RTEMS_ENABLE_MULTIPROCESSING
20RTEMS_ENABLE_CXX
21RTEMS_ENV_RTEMSBSP
22
23RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
24
25RTEMS_CHECK_POSIX_API(RTEMS_BSP)
26RTEMS_CHECK_SMP
27
28AC_MSG_NOTICE([setting up make/custom])
29
30AS_MKDIR_P([make/custom])
31AM_SET_DEPDIR
32test -d ${DEPDIR} || mkdir ${DEPDIR}
33
34rm -f ${DEPDIR}/cfg.P
35cp ${srcdir}/make/custom/default.cfg.in make/custom/default.cfg
36cat << EOF > ${DEPDIR}/cfg.P
37# Do not edit - automatically generated by $0
38make/custom/default.cfg: \$(srcdir)/make/custom/default.cfg.in
39        @\$(MKDIR_P) make/custom
40        cp \$(srcdir)/make/custom/default.cfg.in make/custom/default.cfg
41EOF
42
43# Collect and copy the BSP's make/custom/*.cfg files from the toplevel make
44# directory into the build tree's <bsp>/make/custom subdirectories
45CUSTOM_CFG_FILES=
46f="${RTEMS_BSP}.cfg"
47while test -n "$f"; do
48  cfg_file=
49  _RTEMS_CHECK_CUSTOM_BSP([$f],cfg_file)
50  if test -n "${cfg_file}"; then
51    cp ${cfg_file} make/custom/$f
52cat << EOF >> ${DEPDIR}/cfg.P
53make/custom/$f: ${cfg_file} make/custom/default.cfg
54        cp ${cfg_file} make/custom/$f
55EOF
56    CUSTOM_CFG_FILES="$CUSTOM_CFG_FILES make/custom/$f"
57    f=`grep "^include.*make/custom" ${cfg_file} \
58    | sed \
59      -e 's%^.*custom\/%%' \
60      -e 's%default\.cfg%%'`;
61  else break; fi;
62done
63
64AC_MSG_NOTICE([creating make/${RTEMS_BSP}.cache])
65${MAKE-make} -f ${srcdir}/make/bsp.mak \
66RTEMS_BSP=${RTEMS_BSP} \
67RTEMS_ROOT=. make/${RTEMS_BSP}.cache
68
69# Read back the cache
70AC_CACHE_CHECK([for RTEMS_CPU_MODEL], [ac_cv_env_RTEMS_CPU_MODEL],
71[. ./make/${RTEMS_BSP}.cache])
72RTEMS_CPU_MODEL=$ac_cv_env_RTEMS_CPU_MODEL
73AC_SUBST(RTEMS_CPU_MODEL)
74test -n "${RTEMS_CPU_MODEL}" && \
75  ac_configure_args="$ac_configure_args 'RTEMS_CPU_MODEL=${RTEMS_CPU_MODEL}'"
76
77AC_CACHE_CHECK([for RTEMS_BSP_FAMILY],[ac_cv_env_RTEMS_BSP_FAMILY],
78[RTEMS_BSP_ALIAS([${RTEMS_BSP}],[ac_cv_env_RTEMS_BSP_FAMILY])])
79RTEMS_BSP_FAMILY=$ac_cv_env_RTEMS_BSP_FAMILY
80AC_SUBST(RTEMS_BSP_FAMILY)
81test -n "${RTEMS_BSP_FAMILY}" && \
82  ac_configure_args="$ac_configure_args 'RTEMS_BSP_FAMILY=${RTEMS_BSP_FAMILY}'"
83
84AC_CACHE_CHECK([for CPU_CFLAGS],[ac_cv_env_CPU_CFLAGS],
85[. ./make/${RTEMS_BSP}.cache])
86CPU_CFLAGS=$ac_cv_env_CPU_CFLAGS
87
88AC_CACHE_CHECK([for CFLAGS_OPTIMIZE_V],[ac_cv_env_CFLAGS_OPTIMIZE_V],
89[. ./make/${RTEMS_BSP}.cache])
90CFLAGS_OPTIMIZE_V=$ac_cv_env_CFLAGS_OPTIMIZE_V
91
92# Was CFLAGS set?
93rtems_cv_CFLAGS_set="${CFLAGS+set}"
94
95CFLAGS="${CFLAGS-${CPU_CFLAGS} ${CFLAGS_OPTIMIZE_V}}"
96
97RTEMS_PROG_CC_FOR_TARGET
98RTEMS_PROG_CXX_FOR_TARGET
99AM_PROG_CC_C_O
100RTEMS_PROG_CCAS
101RTEMS_CANONICALIZE_TOOLS
102
103# Append warning flags if CFLAGS wasn't set.
104AS_IF([test "$GCC" = yes && test "$rtems_cv_CFLAGS_set" != set],
105[CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs"])
106
107AS_IF([test -n "${CFLAGS}"],[
108ac_configure_args="$ac_configure_args 'CFLAGS=${CFLAGS}'"])
109
110RTEMS_CHECK_GCC_WEAK
111
112AC_SUBST(CUSTOM_CFG_FILES)
113
114RTEMS_CHECK_NETWORKING(RTEMS_BSP)
115RTEMS_CHECK_MULTIPROCESSING
116
117BSP_SUBDIRS=
118## Configure ${srcdir}/../../cpukit as cpukit/ if multilibs are disabled
119RTEMS_BSP_CONFIG_SUBDIR(
120  [cpukit],[../../cpukit],
121  ['--with-project-root=${with_project_root}../$RTEMS_BSP/' \
122   '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \
123   '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \
124  ],
125  [test x"$multilib" = xno])
126
127## Note: the order of the directories below is essential
128AC_CONFIG_SUBDIRS([make])
129BSP_SUBDIRS="$BSP_SUBDIRS make"
130
131RTEMS_CPU_SUBDIRS(lib/libcpu)
132if test -d "${srcdir}/lib/libcpu/${RTEMS_CPU}"; then
133  libcpu_cpu_subdir="${RTEMS_CPU}"
134else
135  libcpu_cpu_subdir=
136fi
137AC_SUBST(libcpu_cpu_subdir)
138
139# Is there code where there should be for this BSP?
140RTEMS_CPU_SUBDIRS([lib/libbsp])
141AC_SUBST(libbsp_cpu_subdir,$RTEMS_CPU)
142
143BSP_SUBDIRS="$BSP_SUBDIRS lib"
144BSP_SUBDIRS="$BSP_SUBDIRS libchip"
145BSP_SUBDIRS="$BSP_SUBDIRS support"
146BSP_SUBDIRS="$BSP_SUBDIRS wrapup"
147
148# Build testsuites
149RTEMS_BSP_CONFIG_SUBDIR(
150  [testsuites],[../../testsuites],
151  ['--enable-rtems-root=../' \
152   '--enable-project-root=${with_project_root}../$RTEMS_BSP' \
153   '--with-project-top=${with_project_top}../' \
154   '--enable-rtemsbsp=$RTEMS_BSP' \
155   '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \
156   '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \
157  ],
158  [test x"$enable_tests" != x"no"])
159
160AC_SUBST([BSP_SUBDIRS],[$BSP_SUBDIRS])
161
162AS_IF([test "$host_cpu" = sparc],[
163  AC_DEFINE_UNQUOTED([CPU_U32_FIX],[1],
164    [whether to enable ipalignment work-around])
165])
166
167AM_CONDITIONAL([HAS_NETWORKING],[test "$HAS_NETWORKING" = "yes"])
168AM_CONDITIONAL(HAS_SMP,[test "$rtems_cv_HAS_SMP" = "yes"])
169
170RTEMS_PROJECT_ROOT
171
172# Explicitly list all Makefiles here
173AC_CONFIG_FILES([Makefile],
174[${MAKE} make/${RTEMS_BSP}.cache],
175[RTEMS_BSP=${RTEMS_BSP}
176 MAKE=${MAKE}])
177
178AC_CONFIG_FILES([
179support/Makefile
180libchip/Makefile
181lib/Makefile
182lib/libcpu/Makefile
183lib/libbsp/Makefile
184wrapup/Makefile
185])
186
187AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.