Skip to content

Commit

Permalink
Add makefile for mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Arsenault committed Jun 3, 2011
1 parent 8396019 commit aee9f24
Show file tree
Hide file tree
Showing 2 changed files with 242 additions and 0 deletions.
91 changes: 91 additions & 0 deletions Makefile.mingw
@@ -0,0 +1,91 @@
# Makefile for building Popt with MinGW (gcc and gnumake)

POPT_PREFIX ?= C:\popt
POPT_SRC_DIR ?= .

OPT_FLAGS = -Os -DNDEBUG
WARNINGS = -Wall -Wextra
INCLUDE_DIRS = -I$(POPT_SRC_DIR)
DEFINITIONS = -DHAVE_CONFIG_H
CFLAGS = $(OPT_FLAGS) $(WARNINGS) $(INCLUDE_DIRS) $(DEFINITIONS)
CXXFLAGS = $(CFLAGS)
CC = gcc
CXX = g++
RM = del
MKDIR = mkdir
CP = copy


CONFIG_HEADER = config.h
CONFIG_MINGW_HEADER_NAME = config.h.mingw

#CONFIGMAKE_HEADER = configmake.h
#CONFIGMAKE_MINGW_HEADER_NAME = configmake.h.mingw

POPT_SRC = $(POPT_SRC_DIR)/lookup3.c \
$(POPT_SRC_DIR)/poptconfig.c \
$(POPT_SRC_DIR)/popthelp.c \
$(POPT_SRC_DIR)/poptint.c \
$(POPT_SRC_DIR)/poptparse.c \
$(POPT_SRC_DIR)/popt.c

POPT_HEADERS = $(POPT_SRC_DIR)/config.h \
$(POPT_SRC_DIR)/configmake.h \
$(POPT_SRC_DIR)/popt.h \
$(POPT_SRC_DIR)/poptint.h \
$(POPT_SRC_DIR)/system.h

POPT_PUBLIC_HEADERS ?= $(POPT_SRC_DIR)\popt.h

LIB_OBJ = lookup3.o poptconfig.o popthelp.o poptint.o poptparse.o popt.o

LIB_BIN = libpopt.a
TEST_BINS = tdict.exe test1.exe test2.exe
OBJ = $(LIB_OBJ) $(TEST_OBJ)
BIN = $(LIB_BIN) $(TEST_BINS)



all: $(BIN) $(TEST_BINS)

$(CONFIG_HEADER):
$(CP) $(CONFIG_MINGW_HEADER_NAME) $(CONFIG_HEADER)
$(CP) $(CONFIGMAKE_MINGW_HEADER_NAME) $(CONFIGMAKE_HEADER)

%.o: $(POPT_SRC_DIR)/%.c $(CONFIG_HEADER)
$(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)

$(LIB_BIN): $(LIB_OBJ)
$(AR) rc $@ $^

tdict.exe: tdict.c $(LIB_BIN)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $< $(LIB_BIN)

test1.exe: test1.c $(LIB_BIN)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $< $(LIB_BIN)

test2.exe: test2.c $(LIB_BIN)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $< $(LIB_BIN)


RANLIB ?= ranlib

tests: $(TEST_BINS)


install: $(LIB_BIN) $(POPT_PUBLIC_HEADERS)
$(MKDIR) $(POPT_PREFIX)\include
$(MKDIR) $(POPT_PREFIX)\lib
$(CP) $(POPT_PUBLIC_HEADERS) $(POPT_PREFIX)\include
$(RANLIB) $(LIB_BIN)
$(CP) $(LIB_BIN) $(POPT_PREFIX)\lib
.PHONY: install

uninstall:
rmdir /S /Q $(POPT_PREFIX)
.PHONY: uninstall

clean:
$(RM) $(OBJ) $(BIN) $(CONFIG_HEADER)

.PHONY: clean
151 changes: 151 additions & 0 deletions config.h.mingw
@@ -0,0 +1,151 @@
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */

/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
/* #undef HAVE_CFLOCALECOPYCURRENT */

/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */

/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
/* #undef HAVE_DCGETTEXT */

/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */

/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H

/* Define to 1 if you have the <fnmatch.h> header file. */
/* #undef HAVE_FNMATCH_H */

/* Define to 1 if you have the `geteuid' function. */
/* #undef HAVE_GETEUID */

/* Define if the GNU gettext() function is already present or preinstalled. */
/* #undef HAVE_GETTEXT */

/* Define to 1 if you have the `getuid' function. */
/* #undef HAVE_GETUID */

/* Define to 1 if you have the <glob.h> header file. */
/* #undef HAVE_GLOB_H */

/* Define if you have the iconv() function and it works. */
/* #undef HAVE_ICONV */

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H

/* Define to 1 if you have the <langinfo.h> header file. */
/* #undef HAVE_LANGINFO_H */

/* Define to 1 if you have the <libintl.h> header file. */
/* #undef HAVE_LIBINTL_H */

/* Define to 1 if you have the <mcheck.h> header file. */
/* #undef HAVE_MCHECK_H */

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H

/* Define to 1 if you have the `mtrace' function. */
/* #undef HAVE_MTRACE */

/* Define to 1 if you have the `setregid' function. */
/* #undef HAVE_SETREGID */

/* Define to 1 if you have the `srandom' function. */
/* #undef HAVE_SRANDOM */

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H

/* Define to 1 if you have the `stpcpy' function. */
/* #undef HAVE_STPCPY */

/* Define to 1 if you have the `strerror' function. */
#ifndef _MSC_VER
/* The check seems to fail on MSVC, but it actually works */
#define HAVE_STRERROR
#else
#define HAVE_STRERROR 1
#endif

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H

/* Define to 1 if you have the `vasprintf' function. */
/* #undef HAVE_VASPRINTF */

/* Define to 1 if you have the `__secure_getenv' function. */
/* #undef HAVE___SECURE_GETENV */

/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */

/* Name of package */
#define PACKAGE ""

/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */

/* Define to the full name of this package. */
#define PACKAGE_NAME ""

/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""

/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */

/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */

/* Full path to popt top_srcdir. */
/* #undef POPT_SOURCE_PATH */

/* Full path to default POPT configuration directory */
#define POPT_SYSCONFDIR

/* Define to 1 if the C compiler supports function prototypes. */
/* #undef PROTOTYPES */

/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */

/* Version number of package */
/* #undef VERSION */

/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */

/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */

/* Define like PROTOTYPES; this can be used by system headers. */
/* #undef __PROTOTYPES */


0 comments on commit aee9f24

Please sign in to comment.