summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rw-r--r--Makefile.am120
-rwxr-xr-xautogen.sh14
-rw-r--r--configure.ac279
-rw-r--r--hsakmt-1-uninstalled.pc.in5
-rw-r--r--hsakmt-1.pc.in11
-rw-r--r--hsakmt/Makefile53
-rw-r--r--hsakmt/Makefile.am14
-rw-r--r--hsakmt/Makefile.sources25
-rw-r--r--hsakmt/hsakmt-version.h.in50
10 files changed, 518 insertions, 65 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c899cca..0000000
--- a/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-.PHONY: all clean lnx64a lnx
-
-all: lnx64a
-
-lnx64a:
- $(MAKE) -C src lnx64a
-
-lnx:
- $(MAKE) -C src lnx
-
-clean:
- $(MAKE) -C src clean
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..ca85e3c
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,120 @@
+SUBDIRS = hsakmt
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA=hsakmt-1.pc
+
+$(pkgconfig_DATA): hsakmt-1.pc.in
+
+snapshot:
+ distdir="$(distdir)-`date '+%Y%m%d'`"; \
+ test -d "$(srcdir)/.git" && distdir=$$distdir-`cd "$(srcdir)" && git rev-parse HEAD | cut -c 1-6`; \
+ $(MAKE) $(AM_MAKEFLAGS) distdir="$$distdir" dist
+
+GPGKEY=AB5AE780
+USERNAME=$$USER
+RELEASE_XORG_URL = http://xorg.freedesktop.org/archive/individual/lib
+RELEASE_XORG_HOST = $(USERNAME)@xorg.freedesktop.org
+RELEASE_XORG_DIR = /srv/xorg.freedesktop.org/archive/individual/lib
+RELEASE_ANNOUNCE_LIST = xorg-announce@lists.freedesktop.org
+
+tar_gz = $(PACKAGE)-$(VERSION).tar.gz
+tar_bz2 = $(PACKAGE)-$(VERSION).tar.bz2
+
+sha1_tgz = $(tar_gz).sha1
+md5_tgz = $(tar_gz).md5
+
+sha1_tbz2 = $(tar_bz2).sha1
+md5_tbz2 = $(tar_bz2).md5
+
+gpg_file = $(sha1_tgz).asc
+
+$(sha1_tgz): $(tar_gz)
+ sha1sum $^ > $@
+
+$(md5_tgz): $(tar_gz)
+ md5sum $^ > $@
+
+$(sha1_tbz2): $(tar_bz2)
+ sha1sum $^ > $@
+
+$(md5_tbz2): $(tar_bz2)
+ md5sum $^ > $@
+
+$(gpg_file): $(sha1_tgz)
+ @echo "Please enter your GPG password to sign the checksum."
+ gpg --armor --sign $^
+
+HASHFILES = $(sha1_tgz) $(sha1_tbz2) $(md5_tgz) $(md5_tbz2)
+
+release-verify-newer:
+ @echo -n "Checking that no $(VERSION) release already exists at $(RELEASE_XORG_HOST)..."
+ @ssh $(RELEASE_XORG_HOST) test ! -e $(RELEASE_XORG_DIR)/$(tar_gz) \
+ || (echo "Ouch." && echo "Found: $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR)/$(tar_gz)" \
+ && echo "Refusing to try to generate a new release of the same name." \
+ && false)
+ @echo "Good."
+
+release-remove-old:
+ $(RM) $(tar_gz) $(tar_bz2) $(HASHFILES) $(gpg_file)
+
+ensure-prev:
+ @if [[ "$(PREV)" == "" ]]; then \
+ echo "" && \
+ echo "You must set the PREV variable on the make command line to" && \
+ echo "the last version." && \
+ echo "" && \
+ echo "For example:" && \
+ echo " make PREV=0.7.3" && \
+ echo "" && \
+ false; \
+ fi
+
+release-check: ensure-prev release-verify-newer release-remove-old distcheck
+
+release-tag:
+ git tag -u $(GPGKEY) -m "$(PACKAGE) $(VERSION) release" $(PACKAGE)-$(VERSION)
+
+release-upload: release-check $(tar_gz) $(tar_bz2) $(sha1_tgz) $(sha1_tbz2) $(md5_tgz) $(gpg_file)
+ scp $(tar_gz) $(sha1_tgz) $(tar_bz2) $(gpg_file) $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR)
+
+release-publish-message: $(HASHFILES) ensure-prev
+ @echo "Please follow the instructions in RELEASING to push stuff out and"
+ @echo "send out the announcement mails. Here is the excerpt you need:"
+ @echo ""
+ @echo "Lists: $(RELEASE_ANNOUNCE_LIST)"
+ @echo "Subject: [ANNOUNCE] $(PACKAGE) release $(VERSION) now available"
+ @echo "============================== CUT HERE =============================="
+ @echo "A new $(PACKAGE) release $(VERSION) is now available."
+ @echo ""
+ @echo "tar.gz:"
+ @echo " $(RELEASE_XORG_URL)/$(tar_gz)"
+ @echo ""
+ @echo "tar.bz2:"
+ @echo " $(RELEASE_XORG_URL)/$(tar_bz2)"
+ @echo ""
+ @echo "Hashes:"
+ @echo -n " MD5: "
+ @cat $(md5_tgz)
+ @echo -n " MD5: "
+ @cat $(md5_tbz2)
+ @echo -n " SHA1: "
+ @cat $(sha1_tgz)
+ @echo -n " SHA1: "
+ @cat $(sha1_tbz2)
+ @echo ""
+ @echo "GPG signature:"
+ @echo " $(RELEASE_XORG_URL)/$(gpg_file)"
+ @echo " (signed by`gpg --list-keys $(GPGKEY) | grep uid | cut -b4- | tr -s " "`)"
+ @echo ""
+ @echo "Git:"
+ @echo " git://anongit.freedesktop.org/amd/hsakmt"
+ @echo " tag: $(PACKAGE)-$(VERSION)"
+ @echo ""
+ @echo "Log:"
+ @git log --no-merges "$(PACKAGE)-$(PREV)".."$(PACKAGE)-$(VERSION)" | git shortlog | awk '{ printf "\t"; print ; }' | cut -b1-80
+ @echo "============================== CUT HERE =============================="
+ @echo ""
+
+release-publish: release-upload release-tag release-publish-message
+
+.PHONY: release-upload release-publish release-publish-message release-tag
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..fc34bd5
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+if test -z "$NOCONFIGURE"; then
+ $srcdir/configure "$@"
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..1349403
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,279 @@
+dnl Copyright 2015 Red Hat, Inc.
+dnl
+dnl Permission to use, copy, modify, distribute, and sell this software and its
+dnl documentation for any purpose is hereby granted without fee, provided that
+dnl the above copyright notice appear in all copies and that both that
+dnl copyright notice and this permission notice appear in supporting
+dnl documentation, and that the name of Red Hat not be used in
+dnl advertising or publicity pertaining to distribution of the software without
+dnl specific, written prior permission. Red Hat makes no
+dnl representations about the suitability of this software for any purpose. It
+dnl is provided "as is" without express or implied warranty.
+dnl
+dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+dnl PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.57])
+
+# hsakmt versioning scheme
+#
+# - The version in git has an odd MICRO version number
+#
+# - Released versions, have an even MICRO version number
+#
+# - Versions that break ABI must have a new MAJOR number
+#
+# - If you break the ABI, then at least this must be done:
+#
+# - increment MAJOR
+#
+# - In the first development release where you break ABI, find
+# all instances of "hsakmt-n" and change them to hsakmt-(n+1)
+#
+# This needs to be done at least in
+# configure.ac
+# all Makefile.am's
+# hsakmt-n.pc.in
+#
+# This ensures that binary incompatible versions can be installed
+# in parallel. See http://www106.pair.com/rhp/parallel.html for
+# more information
+#
+
+m4_define([hsakmt_major], 1)
+m4_define([hsakmt_minor], 0)
+m4_define([hsakmt_micro], 0)
+
+m4_define([hsakmt_version],[hsakmt_major.hsakmt_minor.hsakmt_micro])
+
+AC_INIT(hsakmt, hsakmt_version, [oded.gabbay@gmail.com], hsakmt)
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+
+# Suppress verbose compile lines
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_CONFIG_HEADERS(config.h)
+
+# Checks for programs.
+AC_CANONICAL_HOST
+AC_PROG_AWK
+test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+dnl HSAKMT_LINK_WITH_ENV(env-setup, program, true-action, false-action)
+dnl
+dnl Compiles and links the given program in the environment setup by env-setup
+dnl and executes true-action on success and false-action on failure.
+AC_DEFUN([HSAKMT_LINK_WITH_ENV],[dnl
+ save_CFLAGS="$CFLAGS"
+ save_LDFLAGS="$LDFLAGS"
+ save_LIBS="$LIBS"
+ CFLAGS=""
+ LDFLAGS=""
+ LIBS=""
+ $1
+ CFLAGS="$save_CFLAGS $CFLAGS"
+ LDFLAGS="$save_LDFLAGS $LDFLAGS"
+ LIBS="$save_LIBS $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([$2])],
+ [hsakmt_cc_stderr=`test -f conftest.err && cat conftest.err`
+ hsakmt_cc_flag=yes],
+ [hsakmt_cc_stderr=`test -f conftest.err && cat conftest.err`
+ hsakmt_cc_flag=no])
+
+ if test "x$hsakmt_cc_stderr" != "x"; then
+ hsakmt_cc_flag=no
+ fi
+
+ if test "x$hsakmt_cc_flag" = "xyes"; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , :, [$4])
+ fi
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+])
+
+dnl Find a -Werror for catching warnings.
+WERROR=
+for w in -Werror -errwarn; do
+ if test "z$WERROR" = "z"; then
+ AC_MSG_CHECKING([whether the compiler supports $w])
+ HSAKMT_LINK_WITH_ENV(
+ [CFLAGS=$w],
+ [int main(int c, char **v) { (void)c; (void)v; return 0; }],
+ [WERROR=$w; yesno=yes], [yesno=no])
+ AC_MSG_RESULT($yesno)
+ fi
+done
+
+dnl HSAKMT_CHECK_CFLAG(flag, [program])
+dnl Adds flag to CFLAGS if the given program links without warnings or errors.
+AC_DEFUN([HSAKMT_CHECK_CFLAG], [dnl
+ AC_MSG_CHECKING([whether the compiler supports $1])
+ HSAKMT_LINK_WITH_ENV(
+ [CFLAGS="$WERROR $1"],
+ [$2
+ int main(int c, char **v) { (void)c; (void)v; return 0; }
+ ],
+ [_yesno=yes],
+ [_yesno=no])
+ if test "x$_yesno" = xyes; then
+ CFLAGS="$CFLAGS $1"
+ fi
+ AC_MSG_RESULT($_yesno)
+])
+
+AC_CHECK_SIZEOF(long)
+
+# Checks for Sun Studio compilers
+AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
+
+# Default CFLAGS to -O -g rather than just the -g from AC_PROG_CC
+# if we're using Sun Studio and neither the user nor a config.site
+# has set CFLAGS.
+if test $SUNCC = yes && \
+ test "x$test_CFLAGS" = "x" && \
+ test "$CFLAGS" = "-g"
+then
+ CFLAGS="-O -g"
+fi
+
+#
+# We ignore hsakmt_major in the version here because the major version should
+# always be encoded in the actual library name. Ie., the soname is:
+#
+# hsakmt-$(hsakmt_major).0.minor.micro
+#
+m4_define([lt_current], [hsakmt_minor])
+m4_define([lt_revision], [hsakmt_micro])
+m4_define([lt_age], [hsakmt_minor])
+
+LT_VERSION_INFO="lt_current:lt_revision:lt_age"
+
+HSAKMT_VERSION_MAJOR=hsakmt_major()
+AC_SUBST(HSAKMT_VERSION_MAJOR)
+HSAKMT_VERSION_MINOR=hsakmt_minor()
+AC_SUBST(HSAKMT_VERSION_MINOR)
+HSAKMT_VERSION_MICRO=hsakmt_micro()
+AC_SUBST(HSAKMT_VERSION_MICRO)
+
+AC_SUBST(LT_VERSION_INFO)
+
+# Check for dependencies
+
+HSAKMT_CHECK_CFLAG([-Wall])
+HSAKMT_CHECK_CFLAG([-Wdeclaration-after-statement])
+HSAKMT_CHECK_CFLAG([-Wno-unused-local-typedefs])
+HSAKMT_CHECK_CFLAG([-fno-strict-aliasing])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_CHECK_HEADER_STDBOOL
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_INT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_UINT8_T
+
+dnl =====================================
+dnl posix_memalign, sigaction, alarm, gettimeofday
+
+AC_CHECK_FUNC(posix_memalign, have_posix_memalign=yes, have_posix_memalign=no)
+if test x$have_posix_memalign = xyes; then
+ AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [Whether we have posix_memalign()])
+fi
+
+AC_CHECK_FUNC(sigaction, have_sigaction=yes, have_sigaction=no)
+if test x$have_sigaction = xyes; then
+ AC_DEFINE(HAVE_SIGACTION, 1, [Whether we have sigaction()])
+fi
+
+AC_CHECK_FUNC(alarm, have_alarm=yes, have_alarm=no)
+if test x$have_alarm = xyes; then
+ AC_DEFINE(HAVE_ALARM, 1, [Whether we have alarm()])
+fi
+
+AC_CHECK_HEADER([sys/mman.h],
+ [AC_DEFINE(HAVE_SYS_MMAN_H, [1], [Define to 1 if we have <sys/mman.h>])])
+
+AC_CHECK_FUNC(mmap, have_mmap=yes, have_mmap=no)
+if test x$have_mmap = xyes; then
+ AC_DEFINE(HAVE_MMAP, 1, [Whether we have mmap()])
+fi
+
+AC_CHECK_FUNC(mprotect, have_mprotect=yes, have_mprotect=no)
+if test x$have_mprotect = xyes; then
+ AC_DEFINE(HAVE_MPROTECT, 1, [Whether we have mprotect()])
+fi
+
+AC_CHECK_FUNC(getpagesize, have_getpagesize=yes, have_getpagesize=no)
+if test x$have_getpagesize = xyes; then
+ AC_DEFINE(HAVE_GETPAGESIZE, 1, [Whether we have getpagesize()])
+fi
+
+AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
+AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
+if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then
+ AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Whether we have gettimeofday()])
+fi
+
+AC_DEFUN([HSAKMT_CHECK_PTHREAD],[dnl
+ if test "z$support_for_pthreads" != "zyes"; then
+ HSAKMT_LINK_WITH_ENV(
+ [$1], [pthread_test_program],
+ [PTHREAD_CFLAGS="$CFLAGS"
+ PTHREAD_LIBS="$LIBS"
+ PTHREAD_LDFLAGS="$LDFLAGS"
+ support_for_pthreads=yes])
+ fi
+])
+
+support_for_pthreads=no
+
+AC_MSG_CHECKING(for pthreads)
+
+HSAKMT_CHECK_PTHREAD([CFLAGS="-pthread"; LDFLAGS="-pthread"])
+HSAKMT_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LIBS="-lpthread"])
+HSAKMT_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LDFLAGS="-lroot"])
+
+if test $support_for_pthreads = yes; then
+ AC_DEFINE([HAVE_PTHREADS], [], [Whether pthreads is supported])
+ if test $ac_cv_tls = none ; then
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ fi
+fi
+
+AC_MSG_RESULT($support_for_pthreads)
+
+AC_SUBST(TOOLCHAIN_SUPPORTS__THREAD)
+AC_SUBST(HAVE_PTHREADS)
+AC_SUBST(PTHREAD_LDFLAGS)
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+
+# Checks for library functions.
+
+AC_FUNC_MALLOC
+AC_FUNC_MMAP
+AC_CHECK_FUNCS([memchr memset strstr])
+
+AC_OUTPUT([hsakmt-1.pc
+ hsakmt-1-uninstalled.pc
+ Makefile
+ hsakmt/Makefile
+ hsakmt/hsakmt-version.h])
diff --git a/hsakmt-1-uninstalled.pc.in b/hsakmt-1-uninstalled.pc.in
new file mode 100644
index 0000000..2468da4
--- /dev/null
+++ b/hsakmt-1-uninstalled.pc.in
@@ -0,0 +1,5 @@
+Name: hsakmt
+Description: The HSAKMT library (version 1)
+Version: @PACKAGE_VERSION@
+Cflags: -I${pc_top_builddir}/${pcfiledir}/hsakmt
+Libs: ${pc_top_builddir}/${pcfiledir}/hsakmt/libhsakmt-1.la
diff --git a/hsakmt-1.pc.in b/hsakmt-1.pc.in
new file mode 100644
index 0000000..61c930f
--- /dev/null
+++ b/hsakmt-1.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hsakmt
+Description: The HSAKMT library (version 1)
+Version: @PACKAGE_VERSION@
+Cflags: -I${includedir}/hsakmt-1
+Libs: -L${libdir} -lhsakmt-1
+
diff --git a/hsakmt/Makefile b/hsakmt/Makefile
deleted file mode 100644
index 5608ab7..0000000
--- a/hsakmt/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# Include directories
-INCLUDES += ../include
-CFLAGS += $(foreach DIR,$(INCLUDES),-I$(DIR))
-
-LIB_NAME = libhsakmt.so
-LIB_MAJOR_VER = 1
-
-# Compiler options
-CFLAGS += -fPIC # Position-independent code required to build shared library
-CFLAGS += -W -Wall -Wextra -Werror -Wno-unused-parameter
-CFLAGS += -Wformat-security -Wswitch-default -Wundef \
- -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \
- -Wlogical-op -Wstrict-prototypes -Wmissing-prototypes \
- -Wmissing-declarations -Wredundant-decls \
- -Wunreachable-code
-CFLAGS += -std=gnu99 -ggdb -pthread -fvisibility=hidden -O2
-
-LDFLAGS += -lrt -pthread -Wl,--version-script=libhsakmt.ver -Wl,-soname=$(LIB_NAME).$(LIB_MAJOR_VER)
-
-OBJS = debug.o globals.o memory.o perfctr.o time.o version.o \
- events.o openclose.o queues.o topology.o fmm.o pmc_table.o \
- libhsakmt.o
-
-.PHONY: all lnx lnx64a clean
-
-# Default target
-all: lnx lnx64a
-
-BUILD_ROOT = ../build
-BUILDDIR = $(BUILD_ROOT)/$(MAKECMDGOALS)
-
-TARGET = $(addprefix $(BUILDDIR)/,$(OBJS))
-
-$(BUILDDIR)/$(LIB_NAME).$(LIB_MAJOR_VER): $(TARGET)
- gcc -shared $(LDFLAGS) -o $@ $^
-
-$(BUILDDIR)/$(LIB_NAME): $(BUILDDIR)/$(LIB_NAME).$(LIB_MAJOR_VER)
- @ln -sf $(LIB_NAME).$(LIB_MAJOR_VER) $(BUILDDIR)/$(LIB_NAME)
-
-lnx: CFLAGS += -m32
-lnx: LDFLAGS += -m32
-lnx: $(BUILDDIR)/$(LIB_NAME)
-
-lnx64a: $(BUILDDIR)/$(LIB_NAME)
-
-clean:
- rm -rf $(BUILD_ROOT)
-
-#Rule
-$(BUILDDIR)/%.o: %.c ../include/hsakmt.h ../include/hsakmttypes.h ../include/linux/kfd_ioctl.h
- @echo Compiling $^
- @mkdir -p $(dir $@)
- gcc $(CFLAGS) -c $< -o $@
diff --git a/hsakmt/Makefile.am b/hsakmt/Makefile.am
new file mode 100644
index 0000000..2d649c5
--- /dev/null
+++ b/hsakmt/Makefile.am
@@ -0,0 +1,14 @@
+include $(top_srcdir)/hsakmt/Makefile.sources
+
+lib_LTLIBRARIES = libhsakmt-1.la
+
+libhsakmt_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined @PTHREAD_LDFLAGS@
+libhsakmt_1_la_LIBADD = @PTHREAD_LIBS@ -lm
+libhsakmt_1_la_SOURCES = $(libhsakmt_sources) $(libhsakmt_headers)
+
+libhsakmtincludedir = $(includedir)/hsakmt-1
+libhsakmtinclude_HEADERS = hsakmt.h hsakmttypes.h kfd_ioctl.h hsakmt-version.h
+noinst_LTLIBRARIES =
+
+.c.s : $(libhsakmtinclude_HEADERS)
+ $(CC) $(CFLAGS) $(ASM_CFLAGS_$(@:hsakmt-%.s=%)) -DHAVE_CONFIG_H -I$(srcdir) -I$(builddir) -I$(top_builddir) -S -o $@ $<
diff --git a/hsakmt/Makefile.sources b/hsakmt/Makefile.sources
new file mode 100644
index 0000000..4285792
--- /dev/null
+++ b/hsakmt/Makefile.sources
@@ -0,0 +1,25 @@
+libhsakmt_sources = \
+ debug.c \
+ events.c \
+ fmm.c \
+ globals.c \
+ libhsakmt.c \
+ libhsakmt.ver \
+ memory.c \
+ openclose.c \
+ perfctr.c \
+ pmc_table.c \
+ queues.c \
+ time.c \
+ topology.c \
+ version.c \
+ $(NULL)
+
+libhsakmt_headers = \
+ fmm.h \
+ hsakmt.h \
+ hsakmttypes.h \
+ kfd_ioctl.h \
+ libhsakmt.h \
+ pmc_table.h \
+ $(NULL)
diff --git a/hsakmt/hsakmt-version.h.in b/hsakmt/hsakmt-version.h.in
new file mode 100644
index 0000000..fa9336d
--- /dev/null
+++ b/hsakmt/hsakmt-version.h.in
@@ -0,0 +1,50 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#ifndef HSAKMT_VERSION_H__
+#define HSAKMT_VERSION_H__
+
+#ifndef LIBHSAKMT_H_INCLUDED
+# error hsakmt-version.h should only be included by libhsakmt.h
+#endif
+
+#define LIBHSAKMT_VERSION_MAJOR @HSAKMT_VERSION_MAJOR@
+#define LIBHSAKMT_VERSION_MINOR @HSAKMT_VERSION_MINOR@
+#define LIBHSAKMT_VERSION_MICRO @HSAKMT_VERSION_MICRO@
+
+#define LIBHSAKMT_VERSION_STRING "@HSAKMT_VERSION_MAJOR@.@HSAKMT_VERSION_MINOR@.@HSAKMT_VERSION_MICRO@"
+
+#define LIBHSAKMT_VERSION_ENCODE(major, minor, micro) ( \
+ ((major) * 10000) \
+ + ((minor) * 100) \
+ + ((micro) * 1))
+
+#define LIBHSAKMT_VERSION HSAKMT_VERSION_ENCODE( \
+ LIBHSAKMT_VERSION_MAJOR, \
+ LIBHSAKMT_VERSION_MINOR, \
+ LIBHSAKMT_VERSION_MICRO)
+
+#endif /* HSAKMT_VERSION_H__ */