#2 Use make macros
Opened a year ago by tbaeder. Modified a year ago
rpms/ tbaeder/i2c-tools master  into  rawhide

file modified
+6 -5
@@ -110,22 +110,23 @@ 

  %autosetup -p1

  

  %build

- make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" BUILD_STATIC_LIB=0 EXTRA=eeprog

+ %set_build_flags

+ %{__make} BUILD_STATIC_LIB=0 EXTRA=eeprog

  pushd eepromer

- make CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS"

+ %{__make} CFLAGS="$RPM_OPT_FLAGS -I../include"

  popd

  pushd py-smbus

  %if %{with python2}

- CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \

+ CFLAGS="$RPM_OPT_FLAGS -I../include" \

    %{__python2} setup.py build -b build-py2

  %endif

- CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \

+ CFLAGS="$RPM_OPT_FLAGS -I../include" \

    %{__python3} setup.py build -b build-py3

  popd

  

  

  %install

- make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} BUILD_STATIC_LIB=0 \

+ %make_install PREFIX=%{_prefix} BUILD_STATIC_LIB=0 \

    EXTRA=eeprog libdir=%{_libdir}

  install -m 755 eepromer/{eepromer,eeprom} \

    $RPM_BUILD_ROOT%{_sbindir}

Use %make_install and %__make to be more portable and %set_build_flags
to use the standard way of getting proper values for $CFLAGS and
$LDFLAGS.

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_parallel_make