This example uses the default compiler(gcc) and linker(gcc) to build a share library on Unix. Note that user is responsible to specify all the need option to make a share library at link time. Complete example is here.
<project>
...
<packaging>a</packaging>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<compilerStartOptions>
<compilerStartOption>${commonCompilerOptions}</compilerStartOption>
</compilerStartOptions>
<sources>
<source>
<directory>${native.source.dir}</directory>
<fileNames>
<fileName>helloFunc.c</fileName>
</fileNames>
</source>
<source>
<directory>${native.source.dir}/include</directory>
</source>
</sources>
<linkerStartOptions>
<linkerStartOption>-shared</linkerStartOption>
</linkerStartOptions>
</configuration>
</plugin>
</plugins>
</build>
</project>