Verified Commit eaff7eb8 authored by Camil Staps's avatar Camil Staps
Browse files

Add a 64-bit Windows version

parent 617c7d76
Pipeline #45824 failed with stage
in 1 minute and 25 seconds
CC=gcc
CFLAGS=-pedantic -Wall -W
CPPFLAGS=-DGNU_C -D_WINDOWS_ -DI486 -DA_64
clm: clm.o
$(CC) clm.o -o clm
clm.o: clm.c cachingcompiler.h
......@@ -89,7 +89,7 @@ extern char *getenv();
#define PATH_NAME_STRING_SIZE PATH_MAX
#define PATH_LIST_STRING_SIZE (PATH_MAX*4)
#else
#define PATH_NAME_STRING_SIZE 256
#define PATH_NAME_STRING_SIZE 1024
#define PATH_LIST_STRING_SIZE 1024
#endif
......@@ -469,7 +469,11 @@ static int clean_path_list_max_size;
static char *clean_lib_path,clean_lib_path_copy[PATH_NAME_STRING_SIZE];
#ifdef _WINDOWS_
# ifdef A_64
static char *clean_cocl_file_name="CleanCompiler64.exe";
# else
static char *clean_cocl_file_name="CleanCompiler.exe";
# endif
#else
static char *clean_cocl_file_name="cocl";
#endif
......@@ -697,9 +701,6 @@ static void need_file (char *file_name,char *extension,char *complete_file_name)
{
#ifdef _WINDOWS_
FileTime time;
complete_file_name[0]='\"';
++complete_file_name;
#endif
if (!find_clean_system_file (file_name, extension,complete_file_name,NULL
......@@ -707,16 +708,9 @@ static void need_file (char *file_name,char *extension,char *complete_file_name)
,&time
#endif
)){
#ifdef _WINDOWS_
strcat (complete_file_name,"\"");
#endif
fprintf (stderr,"Couldn't find %s%s\n", file_name, extension);
exit (1);
}
#ifdef _WINDOWS_
else
strcat (complete_file_name,"\"");
#endif
}
static void get_paths (void)
......@@ -1901,11 +1895,7 @@ static int compile_project_node (P_NODE project_node)
strcpy (last_colon,"Clean System Files");
if (access (abc_file_name,F_OK)!=0){
# ifdef _WINDOWS_
if (mkdir (abc_file_name)!=0)
# else
if (mkdir (abc_file_name,0777)!=0)
# endif
error_s ("Could not create directory %s\n",abc_file_name);
}
......@@ -2100,9 +2090,6 @@ static int compile_project_node (P_NODE project_node)
static int generate_code_for_project_node (P_NODE project_node,char *file_name)
{
char *argv[16],**arg;
#ifdef _WINDOWS_
char quoted_cg_file_name[PATH_NAME_STRING_SIZE];
#endif
if (!silent)
printf ("Generating code for %s\n",project_node->pro_fname);
......@@ -2134,13 +2121,13 @@ static int generate_code_for_project_node (P_NODE project_node,char *file_name)
strcpy (cg_file_name,clean_lib_path);
#ifdef _WINDOWS_
# ifdef A_64
strcat (cg_file_name,"\\CodeGenerator64.exe");
# else
strcat (cg_file_name,"\\CodeGenerator.exe");
#endif
quoted_cg_file_name[0]='\"';
strcpy (quoted_cg_file_name+1,cg_file_name);
strcat (quoted_cg_file_name+1,"\"");
argv[0]=quoted_cg_file_name;
argv[0]=cg_file_name;
# ifdef SPAWNVP_AND_WAIT
{
......@@ -2358,14 +2345,7 @@ static int make_project_to_o_files (void)
for_l (project_node,first_project_node,pro_next){
if (project_node->pro_up_to_date && !project_node->pro_ignore_o && !project_node_is_o_up_to_date (project_node)){
#ifdef _WINDOWS_
char file_name_s[PATH_NAME_STRING_SIZE],*file_name;
file_name_s[0]='\"';
file_name=&file_name_s[1];
#else
char file_name[PATH_NAME_STRING_SIZE];
#endif
#ifdef _WINDOWS_
{
......@@ -2381,10 +2361,6 @@ static int make_project_to_o_files (void)
file_name[strlen (file_name)-4]='\0';
#ifdef _WINDOWS_
strcat (file_name,"\"");
file_name = file_name_s;
#endif
if (!generate_code_for_project_node (project_node,file_name))
return 0;
#if !defined (NO_ASSEMBLE)
......@@ -2466,7 +2442,11 @@ data [] =
#ifdef I486
# ifdef _WINDOWS_
/* header offset 0 */
# ifdef A_64
int_to_2_chars (0x8664)/*machine_type*/,
# else
int_to_2_chars (0x14c)/*machine_type*/,
# endif
int_to_2_chars (3)/*n_sections*/,
int_to_4_chars (817729185)/*time_date_stamp*/,
int_to_4_chars (164)/*symbol_table_pointer*/,
......@@ -3379,7 +3359,7 @@ static int link_project (P_NODE first_project_node,char *options_file_name,char
# ifdef _WINDOWS_
strcpy (linker_file_name_,clean_lib_path);
strcat (linker_file_name_,"/StaticLinker.exe");
strcat (linker_file_name_,DIRECTORY_SEPARATOR_STRING "StaticLinker.exe");
# ifdef SPAWNVP_AND_WAIT
argv[0]=linker_file_name_;
......@@ -3456,7 +3436,7 @@ static int link_project (P_NODE first_project_node,char *options_file_name,char
# endif
#endif
#if defined (USE_CLEANLINKER)
#if defined (USE_CLEANLINKER) && !defined (_WINDOWS_)
*arg++="-con";
#endif
......@@ -3575,17 +3555,9 @@ static int link_project (P_NODE first_project_node,char *options_file_name,char
error_s ("Can't find %s.o",project_node->pro_fname);
}
#ifdef _WINDOWS_
file_name=memory_allocate (strlen (o_file_name)+3);
file_name[0]='\"';
strcpy (file_name+1,o_file_name);
strcat (file_name,"\"");
#else
file_name=memory_allocate (strlen (o_file_name)+1);
strcpy (file_name,o_file_name);
#endif
#ifdef USE_WLINK
*arg++="file";
#endif
......@@ -3640,20 +3612,17 @@ static int link_project (P_NODE first_project_node,char *options_file_name,char
*arg++="-lc";
# endif
# if defined (USE_CLEANLINKER)
strcpy (kernel32_file_name,"\"-l");
strcpy (kernel32_file_name+3,system_file_name+1);
replace_file_name_in_path (kernel32_file_name+3,"kernel_library","");
strcat (kernel32_file_name+3,"\"");
strcpy (kernel32_file_name,"-l");
strcpy (kernel32_file_name+2,system_file_name);
replace_file_name_in_path (kernel32_file_name+2,"kernel_library","");
*arg++ = kernel32_file_name;
strcpy (user32_file_name,"\"-l");
strcpy (user32_file_name+3,system_file_name+1);
replace_file_name_in_path (user32_file_name+3,"user_library","");
strcat (user32_file_name+3,"\"");
strcpy (user32_file_name,"-l");
strcpy (user32_file_name+2,system_file_name);
replace_file_name_in_path (user32_file_name+2,"user_library","");
*arg++ = user32_file_name;
strcpy (gdi32_file_name,"\"-l");
strcpy (gdi32_file_name+3,system_file_name+1);
replace_file_name_in_path (gdi32_file_name+3,"gdi_library","");
strcat (gdi32_file_name+3,"\"");
strcpy (gdi32_file_name,"-l");
strcpy (gdi32_file_name+2,system_file_name);
replace_file_name_in_path (gdi32_file_name+2,"gdi_library","");
*arg++ = gdi32_file_name;
# else
*arg++="-lkernel32";
......@@ -4062,7 +4031,11 @@ void init_directories_from_environment()
#ifdef _WINDOWS_
/* CLEANLIB */
strncpy(clean_lib_directory, clean_home, sizeof(clean_lib_directory));
# ifdef A_64
strncat(clean_lib_directory,"\\Tools\\Clean System 64",sizeof(clean_lib_directory) - strlen(clean_lib_directory));
# else
strncat(clean_lib_directory,"\\Tools\\Clean System",sizeof(clean_lib_directory) - strlen(clean_lib_directory));
# endif
/* CLEANPATH */
strncpy(clean_directory_list, clean_home, sizeof(clean_directory_list));
strncat(clean_directory_list,"\\Libraries\\StdEnv",sizeof(clean_directory_list) - strlen(clean_directory_list));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment