1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/* Gtk+ User Interface Builder
* Copyright (C) 1998 Damon Chaplin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32
#include <unistd.h>
#endif
#include <stdarg.h>
#include <errno.h>
#include <ctype.h>
#include <locale.h>
#include "gladeconfig.h"
#include "gbwidget.h"
#include "glade_project.h"
#include "source.h"
#include "utils.h"
#ifdef HAVE_OS2_H
extern FILE * create_file_if_not_exist (gchar *filename,
GladeStatusCode *status);
static void source_write_makefile_simple (gchar *makefilename)
{
FILE *fp;
if (glade_util_file_exists (makefilename))
return;
fp = glade_util_fopen (makefilename, "wt");
if (fp == NULL)
return;
fprintf (fp,"#\n");
fprintf (fp,"# This is an example makefile for OS/2\n");
fprintf (fp,"#\n");
fprintf (fp,"CC=gcc\n");
fprintf (fp,"GTKLIBS=-L$(X11ROOT)/XFree86/lib -lgtk -lgdk -lglib\n");
#ifdef USE_GNOME
fprintf (fp,"GNOMELIBS=-lgnome -lgnomeui -lgdk_imlib\n");
fprintf (fp,"PACK=-DPACKAGE=\\\"gladtst\\\" -DVERSION=\\\"0.0.1\\\"\n");
#endif
fprintf (fp,"DIRS=-DPACKAGE_DATA_DIR=\\\".\\\" -DPACKAGE_SOURCE_DIR=\\\".\\\"\n");
fprintf (fp,"OBJS=main.o support.o interface.o callbacks.o\n");
fprintf (fp,"CFLAGS=-Zmtd -D__ST_MT_ERRNO__ -I. -I$(X11ROOT)/XFree86/include");
fprintf (fp," $(DIRS)");
#ifdef USE_GNOME
fprintf (fp," $(PACK)");
#endif
fprintf (fp," \n");
fprintf (fp,"\n");
fprintf (fp,"all: gladetst.exe\n");
fprintf (fp,"\n");
fprintf (fp,"%%.o : %%.c\n");
fprintf (fp,"\t$(CC) $(CFLAGS) -c $<\n");
fprintf (fp,"\n");
fprintf (fp,"gladetst.exe: $(OBJS)\n");
fprintf (fp,"\t$(CC) -Zmtd -o $@ $(OBJS) $(GTKLIBS)");
#ifdef USE_GNOME
fprintf (fp," $(GNOMELIBS)");
#endif
fprintf (fp," gladetst.def\n");
fclose (fp);
}
static void source_write_os2_def_file (gchar *filename)
{
FILE *fp;
if (glade_util_file_exists (filename))
return;
fp = glade_util_fopen (filename, "w");
if (fp == NULL)
return;
fprintf (fp,"NAME gladetst WINDOWCOMPAT\n");
fprintf (fp,"HEAPSIZE 0x10000\n");
fprintf (fp,"STACKSIZE 0x10000\n");
fclose (fp);
}
void source_write_os2_files(GbWidgetWriteSourceData * data)
{
gchar *directory;
gchar *filename;
directory = glade_project_get_source_directory (data->project);
filename = glade_util_make_absolute_path (directory, "makefile.os2");
source_write_makefile_simple (filename);
g_free (filename);
filename = glade_util_make_absolute_path (directory, "gladetst.def");
source_write_os2_def_file (filename);
g_free (filename);
}
#endif
|