# $Id: makefile.cyg,v 1.12 2003/02/01 22:14:50 stas_degteff Exp $
# Makefile for Building SMAPI with Mingw32 for NT.
# No support for the Husky build environment.
# Uncomment this for compile info for gdb and display more compiler warnings
DEBUG = -g -pedantic
# Uncomment this for strip all simbols from binaries to reduce file sizes
#STRIP = -s
## programs ##
#use this line if you are using MINGW32 on a Windows box
GCC = gcc
AR = ar
RANLIB = ranlib
#use this line if you are using MINGW32 CPD on a Unix box as cross compiler
#CC = i386-mingw32-gcc
#AR = i386-mingw32-ar
#RANLIB = i386-mingw32-ranlib
RM = rm
## file suffixes ##
C = .c
OBJ = .o
LIB = .a
EXE = .exe
DLL = .dll
## program options ##
# compiler defines
CDEFS =
# common compiler options
CFLAGS = -Wall -mno-cygwin -O3
# options for compile only (link is off)
OBJOPT = -c
# options for build static library
LIBOPT = -static
# options for build dll
DLLOPT = -shared
# option for specify output file name
NAMEOPT = -o
# options for $(AR) program
ARFLAGS = rs
## files ##
TARGET = libsmapicyg$(LIB)
DLLTARGET= smapi$(DLL)
# libraries need to build binary file
LIBS =
## other, usualy not modify below ##
CYGWIN_VERSION = $(shell uname -r)
ifeq ( , $(findstring "1.3.9", $(CYGWIN_VERSION)) )
ifeq ( , $(findstring "1.3.10", $(CYGWIN_VERSION)) )
ifeq ( , $(findstring "1.3.11", $(CYGWIN_VERSION)) )
# new cygwin require library mingwex for build with '-mno-cygwin' option
LIBS += -lmingwex
endif
endif
endif
CFLAGS += $(DEBUG)
.PHONY: distclean clean all static dll programs default
include makefile.inc
default:
@echo Run 'make dll' to build dll version \($(DLLTARGET), $(PROGRAMS)\)
@echo Run 'make static' to build static version \($(TARGET), $(PROGRAMS)\)
@echo Run 'make programs' to build static version of programs \($(PROGRAMS)\)
@echo Run 'make all' to build all above
all: static dll programs
static: $(TARGET)
dll: $(DLLTARGET)
programs: $(PROGRAMS)
%.exe: %.c $(TARGET)
$(CC) $(STRIP) $(CFLAGS) $(CDEFS) $(NAMEOPT)$@ $^ $(LIBS)
.c.o:
$(CC) $(CFLAGS) $(CDEFS) $(OBJOPT) $<
$(TARGET): $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $?
# $(RANLIB) $(TARGET) # 'ar rs' doing this
$(DLLTARGET): $(OBJS)
$(CC) $(DLLOPT) $(CFLAGS) $(NAMEOPT)$@ $^
clean:
-$(RM) *$(OBJ)
distclean:
-$(RM) $(DLLTARGET) $(TARGET) $(PROGRAMS)
syntax highlighted by Code2HTML, v. 0.9.1