Use autotools to generate library

pull/7/head
nirenjan 2015-11-30 22:12:16 -08:00
parent d688334eb9
commit 5e4a6dc826
12 changed files with 37 additions and 16 deletions

View File

@ -1,9 +0,0 @@
SRCS := $(wildcard *.c)
HEADERS := $(wildcard *.h)
test_x52: ${SRCS} ${HEADERS}
gcc -I /usr/include/libusb-1.0/ ${SRCS} -lusb-1.0 -o $@
.PHONY: clean
clean:
rm -f test_x52 *.o

View File

@ -0,0 +1,2 @@
SUBDIRS = src

View File

@ -0,0 +1,3 @@
#!/bin/sh
autoreconf --install

View File

@ -0,0 +1,25 @@
AC_INIT([libx52], [1.0], [nirenjan@gmail.com])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_PROG_CC
AM_PROG_AR
LT_INIT
# Check for libusb-1.0
AC_SEARCH_LIBS([libusb_init], [libusb-1.0], [have_libusb=yes])
if test "x${have_libusb}" = xyes; then
AC_CHECK_HEADERS([libusb-1.0/libusb.h], [], [have_libusb=no])
fi
if test "x${have_libusb}" = xno; then
AC_MSG_ERROR([
-------------------------------------------------------
The library libusb-1.0 and header file libusb.h
are required to build libx52. Stopping...
Check 'config.log' for more information.
-------------------------------------------------------
])
fi
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

View File

@ -0,0 +1,6 @@
lib_LTLIBRARIES = libx52.la
libx52_la_SOURCES = x52_common.h x52_commands.h libx52.h \
x52_control.c x52_core.c \
x52_date_time.c x52_mfd_led.c
pkginclude_HEADERS = libx52.h

View File

@ -14,7 +14,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <libusb.h>
#include <libusb-1.0/libusb.h>
#include "libx52.h"
/*

View File

@ -15,8 +15,6 @@
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include "libx52.h"
#include "x52_commands.h"
#include "x52_common.h"

View File

@ -15,8 +15,6 @@
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include "libx52.h"
#include "x52_commands.h"
#include "x52_common.h"

View File

@ -15,8 +15,6 @@
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include "libx52.h"
#include "x52_commands.h"
#include "x52_common.h"