- the graphics drivers were moved from "demos/config/*" to "demos/graph/*" - a Win32 graphics driver was added. (note that keyboard management is a bit buggy, but it's really usable). - the "demos/Makefile" and "demos/graph/rules.mk" were seriously modified - the demo programs now compile AND run with gcc, Visual C++ and LCC-Win32 !! The other ones should be really easy to add now, as LCC was the really smart ass in this list...VER-2-0-4-PATCH
parent
14954e6bc2
commit
cb58dbb4fb
15 changed files with 868 additions and 307 deletions
@ -0,0 +1,32 @@ |
||||
#**************************************************************************
|
||||
#*
|
||||
#* OS/2 specific rules file, used to compile the OS/2 graphics driver
|
||||
#* to the graphics subsystem
|
||||
#*
|
||||
#**************************************************************************
|
||||
|
||||
ifeq ($(PLATFORM),os2) |
||||
|
||||
GR_OS2 := $(GRAPH_)os2
|
||||
GR_OS2_ := $(GR_OS2)$(SEP)
|
||||
|
||||
# the GRAPH_LINK is expanded each time an executable is linked with the
|
||||
# graphics library.
|
||||
#
|
||||
GRAPH_LINK += $(GR_OS2_)gros2pm.def
|
||||
|
||||
# Add the OS/2 driver object file to the graphics library "graph.a"
|
||||
#
|
||||
GRAPH_OBJS += $(OBJ_)gros2pm.$O
|
||||
|
||||
DEVICES += OS2_PM
|
||||
DEVICE_INCLUDES += $(GR_OS2)
|
||||
|
||||
# the rule used to compile the graphics driver
|
||||
#
|
||||
$(OBJ_)gros2pm.$O: $(GR_OS2_)gros2pm.c $(GR_OS2_)gros2pm.h |
||||
$(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) $I$(GR_OS2) $T$@ $<
|
||||
|
||||
endif |
||||
|
||||
|
@ -0,0 +1,504 @@ |
||||
/*******************************************************************
|
||||
* |
||||
* grwin32.c graphics driver for Win32 platform. 0.1 |
||||
* |
||||
* This is the driver for displaying inside a window under Win32, |
||||
* used by the graphics utility of the FreeType test suite. |
||||
* |
||||
* Written by Antoine Leca. |
||||
* Copyright 1999-2000 by Antoine Leca, David Turner |
||||
* David Turner, Robert Wilhelm, and Werner Lemberg. |
||||
* |
||||
* Borrowing liberally from the other FreeType drivers. |
||||
* |
||||
* This file is part of the FreeType project, and may only be used |
||||
* modified and distributed under the terms of the FreeType project |
||||
* license, LICENSE.TXT. By continuing to use, modify or distribute |
||||
* this file you indicate that you have read the license and |
||||
* understand and accept it fully. |
||||
* |
||||
******************************************************************/ |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
#define WIN32_LEAN_AND_MEAN |
||||
#include <windows.h> |
||||
|
||||
#include "grwin32.h" |
||||
#include "grdevice.h" |
||||
|
||||
|
||||
/* logging facility */ |
||||
#include <stdarg.h> |
||||
|
||||
#define DEBUGxxx |
||||
|
||||
#ifdef DEBUG |
||||
#define LOG(x) LogMessage##x |
||||
#else |
||||
#define LOG(x) /* rien */ |
||||
#endif |
||||
|
||||
#ifdef DEBUG |
||||
static void LogMessage( const char* fmt, ... ) |
||||
{ |
||||
va_list ap; |
||||
|
||||
va_start( ap, fmt ); |
||||
vfprintf( stderr, fmt, ap ); |
||||
va_end( ap ); |
||||
} |
||||
#endif |
||||
/*-------------------*/ |
||||
|
||||
/* Size of the window. */ |
||||
#define WIN_WIDTH 640u |
||||
#define WIN_HEIGHT 450u |
||||
|
||||
/* These values can be changed, but WIN_WIDTH should remain for now a */ |
||||
/* multiple of 32 to avoid padding issues. */ |
||||
|
||||
typedef struct _Translator |
||||
{ |
||||
ULONG winkey; |
||||
grKey grkey; |
||||
|
||||
} Translator; |
||||
|
||||
static |
||||
Translator key_translators[] = |
||||
{ |
||||
{ VK_BACK, grKeyBackSpace }, |
||||
{ VK_TAB, grKeyTab }, |
||||
{ VK_RETURN, grKeyReturn }, |
||||
{ VK_ESCAPE, grKeyEsc }, |
||||
{ VK_HOME, grKeyHome }, |
||||
{ VK_LEFT, grKeyLeft }, |
||||
{ VK_UP, grKeyUp }, |
||||
{ VK_RIGHT, grKeyRight }, |
||||
{ VK_DOWN, grKeyDown }, |
||||
/*
|
||||
{ VK_PAGEUP, grKeyPageUp }, |
||||
{ VK_PAGEDOWN, grKeyPageDown }, |
||||
*/ |
||||
{ VK_END, grKeyEnd }, |
||||
{ VK_F1, grKeyF1 }, |
||||
{ VK_F2, grKeyF2 }, |
||||
{ VK_F3, grKeyF3 }, |
||||
{ VK_F4, grKeyF4 }, |
||||
{ VK_F5, grKeyF5 }, |
||||
{ VK_F6, grKeyF6 }, |
||||
{ VK_F7, grKeyF7 }, |
||||
{ VK_F8, grKeyF8 }, |
||||
{ VK_F9, grKeyF9 }, |
||||
{ VK_F10, grKeyF10 }, |
||||
{ VK_F11, grKeyF11 }, |
||||
{ VK_F12, grKeyF12 } |
||||
}; |
||||
|
||||
/* This is a minimalist driver, it is only able to display */ |
||||
/* a _single_ window. Moreover, only monochrome and gray */ |
||||
/* bitmaps are supported.. */ |
||||
|
||||
/* handle of the window. */ |
||||
static HWND hwndGraphic; |
||||
|
||||
static int window_width, window_height; |
||||
|
||||
/* the following variables are used to set the window title lazily */ |
||||
static int title_set = 1; |
||||
static const char* the_title; |
||||
|
||||
/* bitmap information */ |
||||
static LPBITMAPINFO pbmi; |
||||
static HBITMAP hbm; |
||||
|
||||
/* local event to pass on */ |
||||
static grEvent ourevent; |
||||
static int eventToProcess = 0; |
||||
|
||||
/* destroys the surface*/ |
||||
static |
||||
void done_surface( grSurface* surface ) |
||||
{ |
||||
/* The graphical window has perhaps already destroyed itself */ |
||||
if ( hwndGraphic ) |
||||
{ |
||||
DestroyWindow ( hwndGraphic ); |
||||
PostMessage( hwndGraphic, WM_QUIT, 0, 0 ); |
||||
} |
||||
grDoneBitmap( &surface->bitmap ); |
||||
if ( pbmi ) free ( pbmi ); |
||||
} |
||||
|
||||
static |
||||
const int pixel_mode_bit_count[] = |
||||
{ |
||||
0, |
||||
1, /* mono */ |
||||
4, /* pal4 */ |
||||
8, /* pal8 */ |
||||
8, /* grays */ |
||||
15, /* rgb15 */ |
||||
16, /* rgb16 */ |
||||
24, /* rgb24 */ |
||||
32 /* rgb32 */ |
||||
}; |
||||
|
||||
static |
||||
void refresh_rectangle( grSurface* surface, |
||||
int x, |
||||
int y, |
||||
int w, |
||||
int h ) |
||||
{ |
||||
HDC hDC; |
||||
int row_bytes; |
||||
|
||||
LOG(( "Win32: refresh_rectangle( %08lx, %d, %d, %d, %d )\n", |
||||
(long)surface, x, y, w, h )); |
||||
(void)x; |
||||
(void)y; |
||||
(void)w; |
||||
(void)h; |
||||
|
||||
row_bytes = surface->bitmap.pitch; |
||||
if (row_bytes < 0) row_bytes = -row_bytes; |
||||
|
||||
if ( row_bytes*8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount ) |
||||
pbmi->bmiHeader.biWidth = row_bytes * 8 / pbmi->bmiHeader.biBitCount; |
||||
|
||||
hDC = GetDC ( hwndGraphic ); |
||||
SetDIBits ( hDC, hbm, |
||||
0, |
||||
surface->bitmap.rows, |
||||
surface->bitmap.buffer, |
||||
pbmi, |
||||
DIB_RGB_COLORS ); |
||||
|
||||
ReleaseDC ( hwndGraphic, hDC ); |
||||
|
||||
ShowWindow( hwndGraphic, SW_SHOW ); |
||||
InvalidateRect ( hwndGraphic, NULL, FALSE ); |
||||
UpdateWindow ( hwndGraphic ); |
||||
} |
||||
|
||||
static |
||||
void set_title( grSurface* surface, const char* title ) |
||||
{ |
||||
(void)surface; |
||||
|
||||
/* the title will be set on the next listen_event, just */ |
||||
/* record it there.. */ |
||||
the_title = title; |
||||
title_set = 0; |
||||
} |
||||
|
||||
static |
||||
void listen_event( grSurface* surface, |
||||
int event_mask, |
||||
grEvent* grevent ) |
||||
{ |
||||
MSG msg; |
||||
|
||||
(void)surface; |
||||
(void)event_mask; |
||||
|
||||
if ( hwndGraphic && !title_set ) |
||||
{ |
||||
SetWindowText( hwndGraphic, the_title ); |
||||
title_set = 1; |
||||
} |
||||
|
||||
do |
||||
{ |
||||
while ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ) |
||||
{ |
||||
TranslateMessage( &msg ); |
||||
DispatchMessage( &msg ); |
||||
} |
||||
if (!eventToProcess) |
||||
WaitMessage(); |
||||
} |
||||
while (!eventToProcess); |
||||
|
||||
*grevent = ourevent; |
||||
} |
||||
|
||||
/*
|
||||
* set graphics mode |
||||
* and create the window class and the message handling. |
||||
*/ |
||||
|
||||
/* Declarations of the Windows-specific functions that are below. */ |
||||
static BOOL RegisterTheClass ( void ); |
||||
static BOOL CreateTheWindow ( int width, int height ); |
||||
|
||||
static |
||||
grSurface* init_surface( grSurface* surface, |
||||
grBitmap* bitmap ) |
||||
{ |
||||
static RGBQUAD black = { 0, 0, 0, 0 }; |
||||
static RGBQUAD white = { 0xFF, 0xFF, 0xFF, 0 }; |
||||
|
||||
if( ! RegisterTheClass() ) return 0; /* if already running, fails. */ |
||||
|
||||
/* find some memory for the bitmap header */ |
||||
if ( (pbmi = malloc ( sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ) ) |
||||
/* 256 should really be 2 if not grayscale */ |
||||
== NULL ) |
||||
/* lack of memory; fails the process */ |
||||
return 0; |
||||
|
||||
LOG(( "Win32: init_surface( %08lx, %08lx )\n", |
||||
(long)surface, (long)bitmap )); |
||||
|
||||
LOG(( " -- input bitmap =\n" )); |
||||
LOG(( " -- mode = %d\n", bitmap->mode )); |
||||
LOG(( " -- grays = %d\n", bitmap->grays )); |
||||
LOG(( " -- width = %d\n", bitmap->width )); |
||||
LOG(( " -- height = %d\n", bitmap->rows )); |
||||
|
||||
/* create the bitmap - under Win32, we support all modes as the GDI */ |
||||
/* handles all conversions automatically.. */ |
||||
if ( grNewBitmap( bitmap->mode, |
||||
bitmap->grays, |
||||
bitmap->width, |
||||
bitmap->rows, |
||||
bitmap ) ) |
||||
return 0; |
||||
|
||||
LOG(( " -- output bitmap =\n" )); |
||||
LOG(( " -- mode = %d\n", bitmap->mode )); |
||||
LOG(( " -- grays = %d\n", bitmap->grays )); |
||||
LOG(( " -- width = %d\n", bitmap->width )); |
||||
LOG(( " -- height = %d\n", bitmap->rows )); |
||||
|
||||
bitmap->pitch = -bitmap->pitch; |
||||
surface->bitmap = *bitmap; |
||||
|
||||
/* initialize the header to appropriate values */ |
||||
memset( pbmi, 0, sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ); |
||||
|
||||
switch ( bitmap->mode ) |
||||
{ |
||||
case gr_pixel_mode_mono: |
||||
pbmi->bmiHeader.biBitCount = 1; |
||||
pbmi->bmiColors[0] = white; |
||||
pbmi->bmiColors[1] = black; |
||||
break; |
||||
|
||||
case gr_pixel_mode_gray: |
||||
pbmi->bmiHeader.biBitCount = 8; |
||||
pbmi->bmiHeader.biClrUsed = bitmap->grays; |
||||
{ |
||||
int count = bitmap->grays; |
||||
int x; |
||||
RGBQUAD* color = pbmi->bmiColors; |
||||
|
||||
for ( x = 0; x < count; x++, color++ ) |
||||
{ |
||||
color->rgbRed = |
||||
color->rgbGreen = |
||||
color->rgbBlue = (((count-x)*255)/count); |
||||
color->rgbReserved = 0; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
default: |
||||
free ( pbmi ); |
||||
return 0; /* Unknown mode */ |
||||
} |
||||
|
||||
pbmi->bmiHeader.biSize = sizeof ( BITMAPINFOHEADER ); |
||||
pbmi->bmiHeader.biWidth = bitmap->width; |
||||
pbmi->bmiHeader.biHeight = bitmap->rows; |
||||
pbmi->bmiHeader.biPlanes = 1; |
||||
|
||||
if( ! CreateTheWindow( bitmap->width, bitmap->rows ) ) |
||||
{ |
||||
free ( pbmi ); |
||||
return 0; |
||||
} |
||||
|
||||
surface->done = (grDoneSurfaceFunc) done_surface; |
||||
surface->refresh_rect = (grRefreshRectFunc) refresh_rectangle; |
||||
surface->set_title = (grSetTitleFunc) set_title; |
||||
surface->listen_event = (grListenEventFunc) listen_event; |
||||
|
||||
return surface; |
||||
} |
||||
|
||||
|
||||
/* ---- Windows-specific stuff ------------------------------------------- */ |
||||
|
||||
LRESULT CALLBACK Message_Process( HWND, UINT, WPARAM, LPARAM ); |
||||
|
||||
static |
||||
BOOL RegisterTheClass ( void ) |
||||
{ |
||||
WNDCLASS ourClass = { |
||||
/* UINT style */ 0, |
||||
/* WNDPROC lpfnWndProc */ Message_Process, |
||||
/* int cbClsExtra */ 0, |
||||
/* int cbWndExtra */ 0, |
||||
/* HANDLE hInstance */ 0, |
||||
/* HICON hIcon */ 0, |
||||
/* HCURSOR hCursor */ 0, |
||||
/* HBRUSH hbrBackground*/ 0, |
||||
/* LPCTSTR lpszMenuName */ NULL, |
||||
/* LPCTSTR lpszClassName*/ "FreeTypeTestGraphicDriver" |
||||
}; |
||||
|
||||
ourClass.hInstance = GetModuleHandle( NULL ); |
||||
ourClass.hIcon = LoadIcon(0, IDI_APPLICATION); |
||||
ourClass.hCursor = LoadCursor(0, IDC_ARROW); |
||||
ourClass.hbrBackground= GetStockObject(BLACK_BRUSH); |
||||
|
||||
return RegisterClass(&ourClass) != 0; /* return False if it fails. */ |
||||
} |
||||
|
||||
static |
||||
BOOL CreateTheWindow ( int width, int height ) |
||||
{ |
||||
window_width = width; |
||||
window_height = height; |
||||
|
||||
if ( ! (hwndGraphic = CreateWindow( |
||||
/* LPCSTR lpszClassName; */ "FreeTypeTestGraphicDriver", |
||||
/* LPCSTR lpszWindowName; */ "FreeType Test Graphic Driver", |
||||
/* DWORD dwStyle; */ WS_OVERLAPPED | WS_SYSMENU, |
||||
/* int x; */ CW_USEDEFAULT, |
||||
/* int y; */ CW_USEDEFAULT, |
||||
/* int nWidth; */ width + 2*GetSystemMetrics(SM_CXBORDER), |
||||
/* int nHeight; */ height+ GetSystemMetrics(SM_CYBORDER) |
||||
+ GetSystemMetrics(SM_CYCAPTION), |
||||
/* HWND hwndParent; */ HWND_DESKTOP, |
||||
/* HMENU hmenu; */ 0, |
||||
/* HINSTANCE hinst; */ GetModuleHandle( NULL ), |
||||
/* void FAR* lpvParam; */ NULL)) |
||||
) |
||||
/* creation failed... */ |
||||
return 0; |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
/* Message processing for our Windows class */ |
||||
LRESULT CALLBACK Message_Process( HWND handle, UINT mess, |
||||
WPARAM wParam, LPARAM lParam ) |
||||
{ |
||||
|
||||
switch( mess ) |
||||
{ |
||||
case WM_DESTROY: |
||||
/* warn the main thread to quit if it didn't know */ |
||||
ourevent.type = gr_event_key; |
||||
ourevent.key = grKeyEsc; |
||||
eventToProcess = 1; |
||||
hwndGraphic = 0; |
||||
PostQuitMessage ( 0 ); |
||||
DeleteObject ( hbm ); |
||||
break; |
||||
|
||||
case WM_CREATE: |
||||
{ |
||||
HDC hDC; |
||||
|
||||
hDC = GetDC ( handle ); |
||||
hbm = CreateDIBitmap ( |
||||
/* HDC hdc; handle of device context */ hDC, |
||||
/* BITMAPINFOHEADER FAR* lpbmih; addr.of header*/ &pbmi->bmiHeader, |
||||
/* DWORD dwInit; CBM_INIT to initialize bitmap */ 0, |
||||
/* const void FAR* lpvBits; address of values */ NULL, |
||||
/* BITMAPINFO FAR* lpbmi; addr.of bitmap data */ pbmi, |
||||
/* UINT fnColorUse; RGB or palette indices */ DIB_RGB_COLORS); |
||||
ReleaseDC ( handle, hDC ); |
||||
break; |
||||
} |
||||
|
||||
case WM_PAINT: |
||||
{ |
||||
HDC hDC, memDC; |
||||
HANDLE oldbm; |
||||
PAINTSTRUCT ps; |
||||
|
||||
hDC = BeginPaint ( handle, &ps ); |
||||
memDC = CreateCompatibleDC(hDC); |
||||
oldbm = SelectObject(memDC, hbm); |
||||
BitBlt ( hDC, 0, 0, window_width, window_height, memDC, 0, 0, SRCCOPY); |
||||
ReleaseDC ( handle, hDC ); |
||||
SelectObject ( memDC, oldbm ); |
||||
DeleteObject ( memDC ); |
||||
EndPaint ( handle, &ps ); |
||||
} |
||||
|
||||
case WM_KEYDOWN: |
||||
switch ( wParam ) |
||||
{ |
||||
case VK_ESCAPE: |
||||
ourevent.type = gr_event_key; |
||||
ourevent.key = grKeyEsc; |
||||
eventToProcess = 1; |
||||
break; |
||||
|
||||
default: |
||||
/* lookup list of translated keys */ |
||||
{ |
||||
int count = sizeof( key_translators )/sizeof( key_translators[0] ); |
||||
Translator* trans = key_translators; |
||||
Translator* limit = trans + count; |
||||
for ( ; trans < limit; trans++ ) |
||||
if ( wParam == trans->winkey ) |
||||
{ |
||||
ourevent.key = trans->grkey; |
||||
goto Do_Key_Event; |
||||
} |
||||
} |
||||
} |
||||
|
||||
case WM_CHAR: |
||||
{ |
||||
ourevent.key = wParam; |
||||
|
||||
Do_Key_Event: |
||||
ourevent.type = gr_event_key; |
||||
eventToProcess = 1; |
||||
} |
||||
break; |
||||
|
||||
default: |
||||
return DefWindowProc( handle, mess, wParam, lParam ); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static int init_device( void ) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
static void done_device( void ) |
||||
{ |
||||
} |
||||
|
||||
grDevice gr_win32_device = |
||||
{ |
||||
sizeof( grSurface ), |
||||
"win32", |
||||
|
||||
init_device, |
||||
done_device, |
||||
|
||||
(grDeviceInitSurfaceFunc) init_surface, |
||||
|
||||
0, |
||||
0 |
||||
}; |
||||
|
||||
|
||||
/* End */ |
@ -0,0 +1,23 @@ |
||||
#ifndef GRWIN32_H |
||||
#define GRWIN32_H |
||||
|
||||
#include "grobjs.h" |
||||
|
||||
extern |
||||
grDevice gr_win32_device; |
||||
|
||||
#ifdef GR_INIT_BUILD |
||||
static |
||||
grDeviceChain gr_win32_device_chain = |
||||
{ |
||||
"win32", |
||||
&gr_win32_device, |
||||
GR_INIT_DEVICE_CHAIN |
||||
}; |
||||
|
||||
#undef GR_INIT_DEVICE_CHAIN |
||||
#define GR_INIT_DEVICE_CHAIN &gr_win32_device_chain |
||||
|
||||
#endif /* GR_INIT_BUILD */ |
||||
|
||||
#endif /* GRWIN32_H */ |
@ -0,0 +1,49 @@ |
||||
#**************************************************************************
|
||||
#*
|
||||
#* Win32 specific rules file, used to compile the Win32 graphics driver
|
||||
#* to the graphics subsystem
|
||||
#*
|
||||
#**************************************************************************
|
||||
|
||||
ifeq ($(PLATFORM),win32) |
||||
|
||||
GR_WIN32 := $(GRAPH_)win32
|
||||
GR_WIN32_ := $(GR_WIN32)$(SEP)
|
||||
|
||||
# Add the Win32 driver object file to the graphics library "graph.a"
|
||||
#
|
||||
GRAPH_OBJS += $(OBJ_)grwin32.$O
|
||||
|
||||
DEVICES += WIN32
|
||||
DEVICE_INCLUDES += $(GR_WIN32)
|
||||
|
||||
# the rule used to compile the graphics driver
|
||||
#
|
||||
$(OBJ_)grwin32.$O: $(GR_WIN32_)grwin32.c $(GR_WIN32_)grwin32.h |
||||
$(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) $I$(GR_WIN32) $T$@ $<
|
||||
|
||||
# Now update COMPILE_GRAPH_LIB according to the compiler used on Win32
|
||||
#
|
||||
ifeq ($(CC),gcc) # test for GCC
|
||||
LINK = $(CC) $T$@ $< $(FTLIB)
|
||||
COMMON_LINK = $(LINK) $(COMMON_OBJ)
|
||||
GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB) -luser32 -lgdi32
|
||||
endif |
||||
|
||||
ifeq ($(CC),cl) # test for Visual C++
|
||||
COMPILE_GRAPH_LIB = lib /nologo /out:$(GRAPH_LIB) $(GRAPH_OBJS)
|
||||
LINK = cl /nologo /MD -o $@ $< $(FTLIB)
|
||||
COMMON_LINK = $(LINK) $(COMMON_OBJ)
|
||||
GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB) user32.lib gdi32.lib
|
||||
endif |
||||
|
||||
ifeq ($(CC),lcc) # test for LCC-Win32
|
||||
COMPILE_GRAPH_LIB = lcclib /out:$(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(GRAPH_OBJS))
|
||||
GRAPH_LINK = $(subst /,\\,$(GRAPH_LIB)) user32.lib gdi32.lib
|
||||
LINK_ROOT = lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<)
|
||||
LINK = $(LINK_ROOT) $(subst /,\\,$(FTLIB))
|
||||
COMMON_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(FTLIB))
|
||||
GRAPH_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(FTLIB))
|
||||
endif |
||||
endif |
||||
|
@ -0,0 +1,81 @@ |
||||
#**************************************************************************
|
||||
#*
|
||||
#* X11-specific rules files, used to compile the X11 graphics driver
|
||||
#* when supported by the current platform
|
||||
#*
|
||||
#**************************************************************************
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# Try to detect an X11 setup.
|
||||
#
|
||||
# We simply try to detect a `X11R6/bin', `X11R5/bin' or `X11/bin' in
|
||||
# the current path.
|
||||
#
|
||||
ifneq ($(findstring X11R6$(SEP)bin,$(PATH)),) |
||||
xversion := X11R6
|
||||
else |
||||
|
||||
ifneq ($(findstring X11R5$(SEP)bin,$(PATH)),) |
||||
xversion := X11R5
|
||||
else |
||||
|
||||
ifneq ($(findstring X11$(SEP)bin,$(PATH)),) |
||||
xversion := X11
|
||||
endif |
||||
endif |
||||
endif |
||||
|
||||
ifdef xversion |
||||
X11_PATH := $(subst ;, ,$(PATH)) $(subst :, ,$(PATH))
|
||||
X11_PATH := $(filter %$(xversion)$(SEP)bin,$(X11_PATH))
|
||||
X11_PATH := $(X11_PATH:%$(SEP)bin=%)
|
||||
endif |
||||
|
||||
##########################################################################
|
||||
#
|
||||
# Update some variables to compile the X11 graphics module. Note that
|
||||
# X11 is available on Unix, or on OS/2. However, it only compiles with
|
||||
# gcc on the latter platform, which is why it is safe to use the flags
|
||||
# `-L' and `-l'
|
||||
#
|
||||
ifneq ($(X11_PATH),) |
||||
|
||||
X11_INCLUDE := $(X11_PATH:%=%$(SEP)include)
|
||||
X11_LIB := $(X11_PATH:%=%$(SEP)lib)
|
||||
|
||||
# the GRAPH_LINK variable is expanded each time an executable is linked against
|
||||
# the graphics library..
|
||||
#
|
||||
GRAPH_LINK += $(X11_LIB:%=-L%) -lX11
|
||||
|
||||
# Solaris needs a -lsocket in GRAPH_LINK ..
|
||||
#
|
||||
UNAME := $(shell uname)
|
||||
ifneq ($(findstring $(UNAME),SunOS Solaris),) |
||||
GRAPH_LINK += -lsocket
|
||||
endif |
||||
|
||||
|
||||
# add the X11 driver object file to the graphics library
|
||||
#
|
||||
GRAPH_OBJS += $(OBJ_)grx11.$O
|
||||
|
||||
|
||||
|
||||
GR_X11 := $(GRAPH_)x11
|
||||
GR_X11_ := $(GR_X11)$(SEP)
|
||||
|
||||
DEVICES += X11
|
||||
DEVICE_INCLUDES += $(GR_X11)
|
||||
|
||||
# the rule used to compile the X11 driver
|
||||
#
|
||||
$(OBJ_)grx11.$O: $(GR_X11_)grx11.c $(GR_X11_)grx11.h |
||||
$(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) $I$(GR_X11) \
|
||||
$(X11_INCLUDE:%=$I%) $T$@ $<
|
||||
endif |
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue