[mingw] switched to autotools for Makefile generation

* allows better integration with Clang
* use ./autogen.sh to generate compilation scripts
* old Makefile renamed to mf so that make -f mf can still be invoked
* also fixed one Clang warning
This commit is contained in:
Pete Batard 2011-12-01 19:43:45 +00:00
parent 2390b305c8
commit b6c6e37927
6 changed files with 102 additions and 8 deletions

16
Makefile.am Normal file
View File

@ -0,0 +1,16 @@
INCLUDES = -I$(top_srcdir)
noinst_PROGRAMS = rufus
pkg_v_rc = $(pkg_v_rc_$(V))
pkg_v_rc_ = $(pkg_v_rc_$(AM_DEFAULT_VERBOSITY))
pkg_v_rc_0 = @echo " RC $@";
rufus_rc.o: rufus.rc
$(pkg_v_rc)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(ARCH_RCFLAGS) -i $< -o $@
rufus_SOURCES = fat12.c fat16.c fat32.c br.c file.c drive.c msdos.c format.c stdio.c stdlg.c rufus.c
rufus_CFLAGS = -I./inc $(ARCH_CFLAGS) $(AM_CFLAGS)
# static ensures that the exe can be shared as a standalone, and still allow driver installation
rufus_LDFLAGS = $(AM_LDFLAGS) -static
rufus_LDADD = rufus_rc.o -lsetupapi -lole32 -lgdi32

11
autogen.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# use glibtoolize if it is available
(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize
$LIBTOOLIZE --copy --force || exit 1
aclocal || exit 1
autoheader || exit 1
autoconf || exit 1
automake -a -c || exit 1
./configure --disable-debug $*

67
configure.ac Normal file
View File

@ -0,0 +1,67 @@
AC_INIT([rufus], [1.0.0], [https://github.com/pbatard/rufus/issues], [rufus], [https://github.com/pbatard/rufus])
AM_INIT_AUTOMAKE([-Wno-portability foreign])
AC_CONFIG_SRCDIR([rufus.c])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
# Enable silent build rules by default (Automake v1.11 or later).
# Disable by either passing --disable-silent-rules to configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
AC_PREREQ([2.50])
AC_PROG_CC
AC_PROG_LIBTOOL
LT_LANG([Windows Resource])
AC_C_INLINE
AM_PROG_CC_C_O
AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
AC_MSG_CHECKING([development environment])
case $host in
*-mingw*)
AC_MSG_RESULT([MinGW])
AM_CFLAGS="-Wshadow"
;;
*)
AC_MSG_ERROR([unsupported development environment])
esac
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501"
AM_LDFLAGS="${AM_LDFLAGS} -no-undefined -avoid-version"
# Debug logging
#AC_ARG_ENABLE([log], [AS_HELP_STRING([--enable-log], [enable logging (default y)])],
# [log_enabled=$enableval],
# [log_enabled='yes'])
#if test "x$log_enabled" != "xno"; then
# AC_DEFINE([RUFUS_DEBUG], [1], [Debug logging])
#fi
# Debug symbols
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [keep debug symbols for gdb (default y)]),
[debug_enabled=$enableval],
[debug_enabled='yes'])
if test "x$debug_enabled" = "xyes" ; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
LDFLAGS="-s"
fi
# check for -Wno-pointer-sign compiler support (GCC >= 4)
saved_CFLAGS="${CFLAGS}"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""])
CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags"
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([LIBCONFIG_CFLAGS])
AC_SUBST([LIBCONFIG_LIBADD])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -1,4 +1,4 @@
#
# Rufus STANDALONE Makefile - invoke with "make -f mf"
# This file is part of the Rufus project.
#
# Copyright (c) 2011 Pete Batard <pbatard@akeo.ie>

View File

@ -353,7 +353,7 @@ static BOOL PopulateProperties(int ComboIndex)
{
double HumanReadableSize;
char capacity[64];
char *suffix[] = { "KB", "MB", "GB", "TB", "PB"};
static char *suffix[] = { "KB", "MB", "GB", "TB", "PB"};
char proposed_label[16], no_label[] = STR_NO_LABEL;
int i;

View File

@ -63,7 +63,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
CONTROL "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL,
"SysLink",WS_TABSTOP,46,47,114,9
LTEXT "Version 1.0.0 (Build 59)",IDC_STATIC,46,19,78,8
LTEXT "Version 1.0.0 (Build 60)",IDC_STATIC,46,19,78,8
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP
EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
@ -162,8 +162,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,59
PRODUCTVERSION 1,0,0,59
FILEVERSION 1,0,0,60
PRODUCTVERSION 1,0,0,60
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -180,13 +180,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.0.0.59"
VALUE "FileVersion", "1.0.0.60"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.0.0.59"
VALUE "ProductVersion", "1.0.0.60"
END
END
BLOCK "VarFileInfo"
@ -212,7 +212,7 @@ IDI_ICON ICON "rufus.ico"
STRINGTABLE
BEGIN
IDS_VERSION "Rufus v1.0.0.59"
IDS_VERSION "Rufus v1.0.0.60"
END
#endif // English resources