view src/Makefile.mingw @ 3686:fefd014fda2a

[gaim-migrate @ 3816] yo committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 14 Oct 2002 05:38:21 +0000
parents d26752101ae4
children 764d6f1848b2
line wrap: on
line source

#
# Makefile.mingw
#
# Description: Makefile for win32 (mingw) version of Gaim
#

#
# PATHS
#

BUILD_TOOLS = /usr/local/mingw

INCLUDE_DIR :=		.
GTK_TOP :=		../../win32-dev/gtk_2_0
GAIM_TOP :=		..
GAIM_SRC :=		.
PERL_LIB_DIR :=		../../win32-dev/perl56
PERL_INCLUDE :=         $(PERL_LIB_DIR)/CORE
GAIM_INSTALL_DIR :=	$(GAIM_TOP)/win32-install-dir

##
## VARIABLE DEFINITIONS
##

TARGET = gaim

VERSION := $(shell cat $(GAIM_TOP)/VERSION)

# Compiler and Linker Options

GCOPTS = -B $(BUILD_TOOLS)

CC = gcc.exe $(GCOPTS)

CFLAGS = -g -mno-cygwin -fnative-struct

DEFINES = -DHAVE_CONFIG_H -DVERSION=\"$(VERSION)\" -DGTK_ENABLE_BROKEN

LDFLAGS = -mwindows

#-mconsole
#-mwindows

##
## INCLUDE  MAKEFILES
##


##
## INCLUDE PATHS
##

INCLUDE_PATHS =		-I$(INCLUDE_DIR) \
			-I$(INCLUDE_DIR)/win32 \
			-I$(GAIM_TOP) \
			-I$(GTK_TOP)/include \
			-I$(GTK_TOP)/include/gtk-2.0 \
			-I$(GTK_TOP)/include/glib-2.0 \
			-I$(GTK_TOP)/include/pango-1.0 \
			-I$(GTK_TOP)/include/atk-1.0 \
			-I$(GTK_TOP)/lib/glib-2.0/include \
			-I$(GTK_TOP)/lib/gtk-2.0/include \
			-I$(PERL_INCLUDE)


LIB_PATHS =		-L$(GTK_TOP)/lib \
			-L$(GAIM_SRC) \
			-L$(PERL_LIB_DIR)


##
##  SOURCES, OBJECTS
##

SOUND_H_FILES =		$(GAIM_TOP)/sounds/BuddyArrive.h \
			$(GAIM_TOP)/sounds/BuddyLeave.h \
			$(GAIM_TOP)/sounds/Receive.h \
			$(GAIM_TOP)/sounds/RedAlert.h \
			$(GAIM_TOP)/sounds/Send.h

HEADER_DEPS =		$(SOUND_H_FILES)

DLL_C_SRC =		aim.c \
			about.c \
			away.c \
			browser.c \
			buddy.c \
			buddy_chat.c \
			conversation.c \
			core.c \
			dialogs.c \
			ft.c \
			gaimrc.c \
			gtkimhtml.c \
			gtkspell.c \
			html.c \
			idle.c \
			list.c \
			md5.c \
			module.c \
			multi.c \
			perl.c \
			prefs.c \
			proxy.c \
			prpl.c \
			server.c \
			sound.c \
			util.c \
			win32/win32dep.c \
			win32/MinimizeToTray.c

RC_SRC =		win32/gaimrc.rc

EXE_C_SRC = 		win_aim.c

DLL_OBJECTS = $(DLL_C_SRC:%.c=%.o) 

EXE_OBJECTS = $(EXE_C_SRC:%.c=%.o) $(RC_SRC:%.rc=%.o) 

##
## LIBRARIES
##

DLL_LIBS = 		-lgtk-win32-2.0 \
			-lpango-1.0 \
			-lglib-2.0 \
			-lgdk-win32-2.0 \
			-lgobject-2.0 \
			-lintl \
			-lgmodule-2.0 \
			-lgdk_pixbuf-2.0 \
			-lws2_32 \
			-liberty \
			-lwinmm \
			-lperl56


EXE_LIBS = -lgaim -lglib-2.0

##
## RULES
##

# Make Sound headers
$(GAIM_TOP)/sounds/%.h:
	$(MAKE) -C $(GAIM_TOP)/sounds -f Makefile.mingw $(@F)

# How to make a C file
%.o: %.c
	$(CC) $(CFLAGS) $(INCLUDE_PATHS) $(DEFINES) -c $< -o $@

# How to make an RC file
%.o: %.rc
	windres -i $< -o $@

##
## TARGET DEFINITIONS
##

.PHONY: all clean

all: $(TARGET).exe $(TARGET).dll

install:
	cp $(GAIM_SRC)/gaim.exe $(GAIM_SRC)/gaim.dll $(GAIM_INSTALL_DIR)


#
# BUILD DLL
#

$(TARGET).def: $(HEADER_DEPS) $(DLL_OBJECTS)
	dlltool -D $(TARGET).dll -z $(TARGET).def --export-all-symbols \
		--exclude-symbols WinMain@16 $^

$(TARGET).base: $(HEADER_DEPS) $(DLL_OBJECTS)
	gcc -mdll $(LDFLAGS) -o junk.tmp -Wl,--base-file,$@ $(DLL_OBJECTS) $(LIB_PATHS) $(DLL_LIBS)
	rm -rf junk.tmp

$(TARGET).exp: $(TARGET).base $(TARGET).def
	dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \
		--output-exp $(TARGET).exp --def $(TARGET).def

$(TARGET).dll: $(HEADER_DEPS) $(DLL_OBJECTS) $(TARGET).exp
	gcc -mdll $(LDFLAGS) -o $(TARGET).dll $(DLL_OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(DLL_LIBS)
	rm -rf $(TARGET).exp $(TARGET).def $(TARGET).base

$(TARGET).lib: $(TARGET).def
	dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib	

#
# BUILD EXE
#

$(TARGET).exe: $(TARGET).lib $(EXE_OBJECTS)
	gcc $(LDFLAGS) $(EXE_OBJECTS) $(LIB_PATHS) $(EXE_LIBS) -o $(TARGET).exe

# -Wl,--subsystem,windows

##
## CLEAN RULES
##

clean:
	$(MAKE) -C $(GAIM_TOP)/sounds -f Makefile.mingw clean
	rm -rf *.o ./win32/*.o
	rm -rf $(TARGET).dll
	rm -rf $(TARGET).lib
	rm -rf $(TARGET).exe