[200b2113] | 1 | ## Generate config.mk, config.sh
|
---|
| 2 |
|
---|
| 3 | # Get the directory where the compiler resides.
|
---|
| 4 |
|
---|
| 5 | cc_fullname = run_command(which, meson.get_compiler('c').cmd_array()[0].split(' ')[0], check: true).stdout().strip()
|
---|
| 6 | cc_path = run_command(dirname, cc_fullname, check: true).stdout().strip()
|
---|
| 7 |
|
---|
| 8 | message(['Compiler directory is:', cc_path])
|
---|
| 9 |
|
---|
| 10 | export_cppflags = [
|
---|
[7749646] | 11 | '-isystem', '$(HELENOS_EXPORT_ROOT)/include/libposix',
|
---|
[200b2113] | 12 | '-isystem', '$(HELENOS_EXPORT_ROOT)/include/libc',
|
---|
| 13 | '-idirafter', '$(HELENOS_EXPORT_ROOT)/include',
|
---|
| 14 | ]
|
---|
| 15 |
|
---|
| 16 | export_ldflags = [
|
---|
| 17 | '-nostdlib',
|
---|
| 18 | '-L$(HELENOS_EXPORT_ROOT)/lib',
|
---|
| 19 | '-Wl,--whole-archive',
|
---|
| 20 | '$(HELENOS_EXPORT_ROOT)/lib/libstartfiles.a',
|
---|
| 21 | '-Wl,--no-whole-archive',
|
---|
| 22 | ]
|
---|
| 23 |
|
---|
| 24 | export_ldlibs = [
|
---|
| 25 | '-Wl,--as-needed',
|
---|
| 26 | '-lposix',
|
---|
| 27 | '-lmath',
|
---|
| 28 | '-lc',
|
---|
| 29 | '-lgcc',
|
---|
| 30 | '-Wl,--no-as-needed',
|
---|
| 31 | ]
|
---|
| 32 |
|
---|
| 33 | cc_arch = meson.get_cross_property('cc_arch')
|
---|
| 34 |
|
---|
| 35 | conf_data = configuration_data({
|
---|
| 36 | 'HELENOS_CROSS_PATH' : cc_path,
|
---|
| 37 | 'HELENOS_ARCH' : cc_arch,
|
---|
| 38 | 'HELENOS_CFLAGS' : ' '.join(arch_uspace_c_args),
|
---|
| 39 | 'HELENOS_CXXFLAGS' : ' '.join(arch_uspace_c_args),
|
---|
| 40 | 'HELENOS_CPPFLAGS' : ' '.join(export_cppflags),
|
---|
| 41 | 'HELENOS_LDFLAGS' : ' '.join(export_ldflags),
|
---|
| 42 | 'HELENOS_LDLIBS' : ' '.join(export_ldlibs),
|
---|
| 43 | 'HELENOS_TARGET' : cc_arch + '-helenos',
|
---|
| 44 | })
|
---|
| 45 |
|
---|
| 46 | config_mk = configure_file(
|
---|
| 47 | input: 'config.mk.in',
|
---|
| 48 | output: 'config.mk',
|
---|
| 49 | configuration: conf_data,
|
---|
| 50 | )
|
---|
| 51 |
|
---|
| 52 | config_sh = custom_target('config.sh',
|
---|
| 53 | input: config_mk,
|
---|
| 54 | output: 'config.sh',
|
---|
| 55 | command: [ sed, 's:$(HELENOS_EXPORT_ROOT):${HELENOS_EXPORT_ROOT}:g', '@INPUT@' ],
|
---|
| 56 | capture: true,
|
---|
| 57 | )
|
---|