-export CFLAGS="${CFLAGS} -fpie -fvisibility=hidden"
-export LDFLAGS="${LDFLAGS} -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+export CFLAGS+=" -fpie -fvisibility=hidden"
+export CXXFLAGS+=" -fpie -fvisibility=hidden"
+export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+
+%if "%{profile}" == "mobile"
+export CFLAGS="$CFLAGS -DTIZEN_MOBILE"
+%else
+%if "%{profile}" == "wearable"
+export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
+%endif
+%endif
+
+%cmake \
+%if "%{profile}" == "mobile"
+ -DTIZEN_MOBILE=YES \
+ -DTIZEN_WEARABLE=NO \
+ -DTIZEN_IVI=NO \
+%else
+%if "%{profile}" == "wearable"
+ -DTIZEN_MOBILE=NO \
+ -DTIZEN_WEARABLE=YES \
+ -DTIZEN_IVI=NO \
+%else
+%if "%{profile}" == "ivi"
+ -DTIZEN_MOBILE=NO \
+ -DTIZEN_WEARABLE=NO \
+ -DTIZEN_IVI=YES \
+%else
+ -DTIZEN_MOBILE=NO \
+ -DTIZEN_WEARABLE=NO \
+ -DTIZEN_IVI=NO \
+%endif
+%endif
+%endif