Skip to content

Commit

Permalink
Merge pull request #66 from zboszor/release
Browse files Browse the repository at this point in the history
Handle LDFLAGS
  • Loading branch information
neurobin authored Nov 20, 2018
2 parents 39cf922 + 0131940 commit 3c95172
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/shc.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static const char * help[] = {
" Name Default Usage",
" CC cc C compiler command",
" CFLAGS <none> C compiler flags",
" LDFLAGS <none> Linker flags",
"",
" Please consult the shc man page.",
"",
Expand Down Expand Up @@ -1229,7 +1230,7 @@ int write_C(char * file, char * argv[])

int make(void)
{
char * cc, * cflags;
char * cc, * cflags, * ldflags;
char cmd[SIZE];

cc = getenv("CC");
Expand All @@ -1238,14 +1239,17 @@ int make(void)
cflags = getenv("CFLAGS");
if (!cflags)
cflags = "";
ldflags = getenv("LDFLAGS");
if (!ldflags)
ldflags = "";

if(!file2){
file2=(char*)realloc(file2,strlen(file)+3);
strcpy(file2,file);
file2=strcat(file2,".x");

}
sprintf(cmd, "%s %s %s.x.c -o %s", cc, cflags, file, file2);
sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2);
if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd);
if (system(cmd))
return -1;
Expand Down

0 comments on commit 3c95172

Please sign in to comment.