diff --git a/Makefile b/Makefile
index fd5f2268c85bcbb505c943244e2456247ec2798d..77f3305be42cf3bf750fbed64aa4c60ae740427e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
-SUBDIRS=compiler lib test examples
+SUBDIRS=compiler lib test examples packaging
 export LABCOMM_JAR=$(shell pwd)/compiler/labcomm_compiler.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
 .PHONY: all
-all: $(SUBDIRS:%=make-%)
+all: $(SUBDIRS:%=all-%)
 
-.PHONY: make-%
-make-%:
+.PHONY: all-%
+all-%:
 	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
 
 .PHONY: test
@@ -29,3 +29,7 @@ distclean: clean $(SUBDIRS:%=distclean-%)
 .PHONY: distclean-%
 distclean-%:
 	$(MAKE) -C $* distclean
+
+.PHONY: srpm
+srpm:
+	make -C packaging $@
diff --git a/compiler/Makefile b/compiler/Makefile
index 24444404faab2dea0ba5243135daec08a28828f2..f9353420fff395a687f06dac758c2382c131f72a 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -1,4 +1,16 @@
-all: 
+.PHONY: all
+all: ant-all
 
-%:
+.PHONY: test
+test: ant-test
+
+.PHONY: clean
+clean: ant-clean
+	rm -f *~
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: ant-%
+ant-%:
 	ant $*
diff --git a/compiler/labcomm b/compiler/labcomm
new file mode 100755
index 0000000000000000000000000000000000000000..604b83a9e365b4a6dc36adc4faca54a3be2b2f1d
--- /dev/null
+++ b/compiler/labcomm
@@ -0,0 +1,2 @@
+#!/bin/sh
+java -jar /lib/labcomm_compiler.jar "$@"
diff --git a/compiler/labcomm2006 b/compiler/labcomm2006
new file mode 100755
index 0000000000000000000000000000000000000000..77c38e83155b13cda559d5a152dc3147e436c554
--- /dev/null
+++ b/compiler/labcomm2006
@@ -0,0 +1,2 @@
+#!/bin/sh
+java -jar /lib/labcomm2006_compiler.jar "$@"
diff --git a/compiler/labcomm2014 b/compiler/labcomm2014
new file mode 100755
index 0000000000000000000000000000000000000000..901a413a2575e4361fbdbd53925a9f4b9074f231
--- /dev/null
+++ b/compiler/labcomm2014
@@ -0,0 +1,2 @@
+#!/bin/sh
+java -jar /lib/labcomm2014_compiler.jar "$@"
diff --git a/packaging/.gitignore b/packaging/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..9f87b19fef31586d928cf2dd4a18d5ea8c69a39f
--- /dev/null
+++ b/packaging/.gitignore
@@ -0,0 +1,2 @@
+labcomm-*.src.rpm
+rpmbuild
diff --git a/packaging/Makefile b/packaging/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0c15aeb630ae9448d1d1df0e9a62847577fa6267
--- /dev/null
+++ b/packaging/Makefile
@@ -0,0 +1,18 @@
+.PHONY: all
+all:
+
+.PHONY: test
+test:
+
+.PHONY: clean
+clean:
+	rm -rf rpmbuild
+	rm -f *~
+
+.PHONY: distclean
+distclean: clean
+	rm -f labcomm-*.src.rpm
+
+.PHONY: srpm
+srpm:
+	./make_srpm
diff --git a/packaging/make_srpm b/packaging/make_srpm
new file mode 100755
index 0000000000000000000000000000000000000000..3468367ead4b97119ccf548af2df52e18bfd0d0c
--- /dev/null
+++ b/packaging/make_srpm
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+spec() {
+cat << 'EOF'
+Name:      labcomm
+Version:   __VERSION__
+Release:   1
+Summary:   LabComm communication protocol
+License:   GPLv3
+
+# https://gitlab.control.lth.se/anders_blomdell/labcomm/repository/archive.tar.gz?__COMMIT__
+Source0:  labcomm.__DESCRIBE__.tar.gz
+
+BuildRequires: gcc
+BuildRequires: ant
+BuildRequires: java
+BuildRequires: mono-core
+
+%description
+LabComm communication protocol
+
+%package devel
+Summary: LabComm communication protocol
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+LabComm communication protocol
+
+%
+%prep
+%setup -q -c -a 0
+
+%build
+pwd
+make
+
+%install
+
+# 
+# C 
+#
+install -d ${RPM_BUILD_ROOT}/%{_libdir}
+install lib/c/liblabcomm2006.a ${RPM_BUILD_ROOT}/%{_libdir}/
+install lib/c/liblabcomm2006.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2006.so.__VERSION__
+ln -s liblabcomm2006.so.__VERSION__ ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2006.so
+install lib/c/liblabcomm2014.a ${RPM_BUILD_ROOT}/%{_libdir}/
+install lib/c/liblabcomm2014.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2014.so.__VERSION__
+ln -s liblabcomm2014.so.__VERSION__ ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2014.so
+install -d ${RPM_BUILD_ROOT}/%{_includedir}/labcomm
+install lib/c/2014/*h ${RPM_BUILD_ROOT}/%{_includedir}/labcomm
+install -d ${RPM_BUILD_ROOT}/%{_includedir}/labcomm2006
+install lib/c/2006/*h ${RPM_BUILD_ROOT}/%{_includedir}/labcomm2006
+
+#
+# java 
+#
+install -d ${RPM_BUILD_ROOT}/usr/lib
+install -m u=r,g=r,o=r compiler/labcomm2014_compiler.jar ${RPM_BUILD_ROOT}/usr/lib
+install -m u=r,g=r,o=r compiler/labcomm2006_compiler.jar ${RPM_BUILD_ROOT}/usr/lib
+install -m u=r,g=r,o=r lib/java/labcomm2014.jar ${RPM_BUILD_ROOT}/usr/lib
+install -m u=r,g=r,o=r lib/java/labcomm2006.jar ${RPM_BUILD_ROOT}/usr/lib
+
+install -d ${RPM_BUILD_ROOT}/%{_bindir}
+install -m u=rx,g=rx,o=rx \
+        compiler/labcomm2014 ${RPM_BUILD_ROOT}/%{_bindir}/labcomm2014
+install -m u=rx,g=rx,o=rx \
+        compiler/labcomm2006 ${RPM_BUILD_ROOT}/%{_bindir}/labcomm2006
+ls -l ${RPM_BUILD_ROOT}/%{_bindir}
+
+#
+# C#
+#
+install -d ${RPM_BUILD_ROOT}/usr/lib
+install -m u=r,g=r,o=r lib/csharp/labcomm.dll ${RPM_BUILD_ROOT}/usr/lib
+
+#
+# Python
+#
+install -d ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm
+install lib/python/labcomm/* ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm
+
+%files
+%defattr (-, root, root)
+%exclude /usr/lib/debug
+%exclude /usr/lib/labcomm2014_compiler.jar
+%exclude /usr/lib/labcomm2006_compiler.jar
+/usr/lib/*
+%{_libdir}/*
+
+%files devel
+%defattr (-, root, root)
+/usr/lib/labcomm2014_compiler.jar
+/usr/lib/labcomm2006_compiler.jar
+%{_includedir}/*
+%{_bindir}/*
+
+EOF
+}
+
+# Create a suitable directory for rpmbuild
+rm -rf rpmbuild
+mkdir -p rpmbuild/BUILD
+mkdir -p rpmbuild/SPECS
+mkdir -p rpmbuild/RPMS
+mkdir -p rpmbuild/SRPMS
+mkdir -p rpmbuild/SOURCES
+rm -rf rpmbuild/SOURCES/*
+
+# Create spec and .tar.gz
+DESCRIBE=$(git describe | sed -e 's/^v\(.*\)/\1/')
+VERSION=$(echo ${DESCRIBE} | sed -e 's/-/./g')
+COMMIT=$(git rev-parse HEAD)
+(
+    spec | \
+        sed -e "s/__VERSION__/${VERSION}/g" | \
+        sed -e "s/__DESCRIBE__/${DESCRIBE}/g" | \
+        sed -e "s/__COMMIT__/${COMMIT}/g" \
+) > rpmbuild/SPECS/labcomm.spec
+(
+    cd $(git rev-parse --show-toplevel)
+    git archive --format tar HEAD
+) > rpmbuild/SOURCES/labcomm.${DESCRIBE}.tar.gz
+rpmbuild --define "_topdir $(pwd)/rpmbuild" \
+         -bs rpmbuild/SPECS/labcomm.spec
+mv rpmbuild/SRPMS/* .