mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 17:05:11 +00:00
[MOD] Incremental builds, use cc
This commit is contained in:
parent
8ce69d0829
commit
24c6e70cb7
3 changed files with 27 additions and 6 deletions
5
Makefile
5
Makefile
|
|
@ -1,10 +1,7 @@
|
||||||
# Makefile for building Parsee
|
# (GNU)Makefile for building Parsee
|
||||||
# ================================
|
# ================================
|
||||||
# TODO: Consider making something akin to a configure script that checks
|
# TODO: Consider making something akin to a configure script that checks
|
||||||
# for dependencies, or maybe even use *autoconf* (the devil!)
|
# for dependencies, or maybe even use *autoconf* (the devil!)
|
||||||
#
|
|
||||||
# TODO: Either get rid of the GNU extensions, or use a script/program
|
|
||||||
# to build Parsee on a POSIXly environment. I'd dig parsee-buildout, tbf.
|
|
||||||
|
|
||||||
|
|
||||||
# =========================== Parsee Flags =============================
|
# =========================== Parsee Flags =============================
|
||||||
|
|
|
||||||
26
build.c
26
build.c
|
|
@ -9,12 +9,12 @@
|
||||||
* cc build.c -o /tmp/build && /tmp/build
|
* cc build.c -o /tmp/build && /tmp/build
|
||||||
*
|
*
|
||||||
* TODO: Parallel jobs, CFLAGS and LDFLAGS.
|
* TODO: Parallel jobs, CFLAGS and LDFLAGS.
|
||||||
*
|
|
||||||
* Note that this bit is formatted differently.
|
* Note that this bit is formatted differently.
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* LICENSE: CC0
|
* LICENSE: CC0
|
||||||
* Written-By: LDA [lda@freetards.xyz] [@fourier:ari.lt] */
|
* Written-By: LDA [lda@freetards.xyz] [@fourier:ari.lt] */
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#define DEFAULT_BUILD_PATH "build.conf"
|
#define DEFAULT_BUILD_PATH "build.conf"
|
||||||
#define DEFAULT_COMPILER "cc"
|
#define DEFAULT_COMPILER "cc"
|
||||||
|
|
@ -250,6 +251,11 @@ destroy_buildinfo(buildinfo_t *info)
|
||||||
free(info->basic.obj);
|
free(info->basic.obj);
|
||||||
info->basic.obj = NULL;
|
info->basic.obj = NULL;
|
||||||
}
|
}
|
||||||
|
if (info->basic.cc)
|
||||||
|
{
|
||||||
|
free(info->basic.cc);
|
||||||
|
info->basic.cc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (info->repo)
|
if (info->repo)
|
||||||
{
|
{
|
||||||
|
|
@ -352,6 +358,16 @@ mkdir_rec(char *dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static time_t
|
||||||
|
mod_date(char *file)
|
||||||
|
{
|
||||||
|
struct stat s;
|
||||||
|
if (stat(file, &s))
|
||||||
|
{
|
||||||
|
return (time_t) 0;
|
||||||
|
}
|
||||||
|
return s.st_mtime;
|
||||||
|
}
|
||||||
static bool
|
static bool
|
||||||
build_file(char *cSource, buildinfo_t info, bool isTool)
|
build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
{
|
{
|
||||||
|
|
@ -384,6 +400,14 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
}
|
}
|
||||||
mkdir_rec(oFileName);
|
mkdir_rec(oFileName);
|
||||||
|
|
||||||
|
if (!isTool && (mod_date(cSource) < mod_date(oFileName)))
|
||||||
|
{
|
||||||
|
free(objPath);
|
||||||
|
free(oFileName);
|
||||||
|
free(oFile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
args[i++] = Compiler(info);
|
args[i++] = Compiler(info);
|
||||||
if (isTool)
|
if (isTool)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ BINARY=parsee
|
||||||
SOURCE=src
|
SOURCE=src
|
||||||
INCLUDES=src/include
|
INCLUDES=src/include
|
||||||
OBJECT=build
|
OBJECT=build
|
||||||
CC=tcc
|
CC=cc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue