-DVERSION=$(VERSION) \
define generate_common
- rm -R -f build_$(1)
- mkdir build_$(1)
- cd build_$(1) && cmake -G"Unix Makefiles" \
+ rm -R -f build_$(2)
+ mkdir build_$(2)
+ cd build_$(2) && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DLWEXT4_BUILD_SHARED_LIB=ON \
- $(2) \
+ $(3) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
endef
define generate_common_static
- rm -R -f build_$(1)
- mkdir build_$(1)
- cd build_$(1) && cmake -G"Unix Makefiles" \
+ rm -R -f build_$(2)
+ mkdir build_$(2)
+ cd build_$(2) && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DLWEXT4_BUILD_SHARED_LIB=OFF \
- $(2) \
+ $(3) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
endef
generic:
- $(call generate_common_static,$@)
+ $(call generate_common_static,$@,$@)
osx:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
osx32:
- $(call generate_common,$@,-DCMAKE_OSX_ARCHITECTURES=i386)
+ $(call generate_common,$@,osx,-DCMAKE_OSX_ARCHITECTURES=i386)
osx-arm64:
- $(call generate_common,$@)
+ $(call generate_common,$@,osx)
cortex-m0:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m0+:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m3:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m4:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m4f:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m7:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
arm-sim:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
avrxmega7:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
msp430:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
mingw:
- $(call generate_common,$@,-DWIN32=1)
+ $(call generate_common,$@,$@,-DWIN32=1)
mingw-32:
- $(call generate_common,$@,-DWIN32=1)
+ $(call generate_common,$@,$@,-DWIN32=1)
lib_only:
rm -R -f build_lib_only
def build(target, options):
if target.platform == 'linux':
type = 'generic'
+ build_suffix = type
blockdev = 'linux'
ext = 'a'
device = 'dev'
type = 'osx'
elif target.arch == 'arm64':
type = 'osx-arm64'
+ build_suffix = 'osx'
make_toolchain('toolchain/%s.cmake' % type, target.arch, target.sdk_prefix, target.sdk)
blockdev = 'linux'
ext = 'dylib'
device = 'dev'
elif target.platform == 'windows':
type = 'mingw' if target.bits == 64 else 'mingw-32'
+ build_suffix = type
blockdev = 'windows'
ext = 'dll'
device = 'windows'
target.command('mkdir -p %s/include/lwext4' % target.directory)
target.command('cp -r include/* %s/include/lwext4' % target.directory)
target.command('make %s' % type)
- target.command('make -j%d -C build_%s' % (target.parallel, type))
- target.command('cp -r build_%s/include/generated %s/include/lwext4' % (type, target.directory))
+ target.command('make -j%d -C build_%s' % (target.parallel, build_suffix))
+ target.command('cp -r build_%s/include/generated %s/include/lwext4' % (build_suffix, target.directory))
target.command('cp blockdev/%s/file_%s.h %s/include/lwext4' % (blockdev, device, target.directory))
target.command('mkdir -p %s/lib' % target.directory)
- target.command('cp build_%s/src/liblwext4.%s %s/lib' % (type, ext, target.directory))
- target.command('cp build_%s/blockdev/libblockdev.%s %s/lib' % (type, ext, target.directory))
+ target.command('cp build_%s/src/liblwext4.%s %s/lib' % (build_suffix, ext, target.directory))
+ target.command('cp build_%s/blockdev/libblockdev.%s %s/lib' % (build_suffix, ext, target.directory))