From efd09b494034b3964130143d27dfd27d5dac8e3b Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sat, 15 Oct 2011 02:27:54 -0500 Subject: [PATCH 1/5] properly set include dir based on OS --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fe0a273d..b4aa753d 100644 --- a/Makefile +++ b/Makefile @@ -18,16 +18,23 @@ ENDIAN=little # BIN=bin +# Lib dir +ifeq ($(OS),osx) +LIBDIR=/sw/lib +else +LIBDIR=/usr/lib +endif + RM=rm -f CC=gcc -CLD=gcc -O3 -L/sw/lib +CLD=gcc -O3 -L$(LIBDIR) YACC=bison -v -b$(GENERATED)/y LEX=lex INCLUDE=include GENERATED=generated DEFINES=-DU2_OS_$(OS) -DU2_OS_ENDIAN_$(ENDIAN) -CFLAGS=-O3 -I/sw/include -I$(INCLUDE) -I $(GENERATED) $(DEFINES) +CFLAGS=-O3 -I$(LIBDIR) -I$(INCLUDE) -I $(GENERATED) $(DEFINES) CWFLAGS=-Wall .y.o: From 21378a276e59b81dbcd7d3a92f68d6e20352e3ce Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sat, 15 Oct 2011 02:28:14 -0500 Subject: [PATCH 2/5] U2_OS_LoomBits wasn't being set when OS=linux --- include/c/portable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/c/portable.h b/include/c/portable.h index a9dd83eb..20c6c8fc 100644 --- a/include/c/portable.h +++ b/include/c/portable.h @@ -53,7 +53,7 @@ **/ # if defined(U2_OS_linux) # define U2_OS_LoomBase 0x4000000 - +# define U2_OS_LoomBits 28 // ie, 2^28 words == 1GB # elif defined(U2_OS_osx) # ifdef __LP64__ # define U2_OS_LoomBase 0x200000000 From 29e008f30655d9ed97460b0441d21e1548c465dc Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sat, 15 Oct 2011 02:29:28 -0500 Subject: [PATCH 3/5] ignore .tags and TAGS files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index cecd060f..9a4daa16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.o generated run +TAGS +.tags \ No newline at end of file From 1c4e69a7f3bcf7c352958d2d51be55a1d73715ab Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sat, 15 Oct 2011 02:48:12 -0500 Subject: [PATCH 4/5] portability issue with st_mtimespec (OSX) vs st_mtime (linux) --- c/vere.c | 14 ++++++++++++-- f/unix.c | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/c/vere.c b/c/vere.c index e9a562fa..75e10a41 100644 --- a/c/vere.c +++ b/c/vere.c @@ -439,9 +439,14 @@ _vere_kernel(struct vere_state* v, } else { if ( (stat(paq_c, &paq_stat) < 0) || +#ifdef U2_OS_linux + (pod_stat.st_mtime > paq_stat.st_mtime) +#else (pod_stat.st_mtimespec.tv_sec > paq_stat.st_mtimespec.tv_sec) || ((pod_stat.st_mtimespec.tv_sec == (pod_stat.st_mtimespec.tv_sec)) && - (pod_stat.st_mtimespec.tv_nsec > paq_stat.st_mtimespec.tv_nsec)) ) + (pod_stat.st_mtimespec.tv_nsec > paq_stat.st_mtimespec.tv_nsec)) +#end + ) { FILE *fil; u3_fox src, gen, ker; @@ -661,9 +666,14 @@ _vere_shell(struct vere_state* v, if ( v->new_b || (stat(paq_c, &paq_stat) < 0) || +#ifdef U2_OS_linux + (pod_stat.st_mtime > paq_stat.st_mtime) +#else (pod_stat.st_mtimespec.tv_sec > paq_stat.st_mtimespec.tv_sec) || ((pod_stat.st_mtimespec.tv_sec == (pod_stat.st_mtimespec.tv_sec)) && - (pod_stat.st_mtimespec.tv_nsec > paq_stat.st_mtimespec.tv_nsec)) ) + (pod_stat.st_mtimespec.tv_nsec > paq_stat.st_mtimespec.tv_nsec)) +#end + ) { printf("[vere: building shell: %s]\n", pod_c); ver = _vere_fire(v, _vere_file(v->x, pod_c)); diff --git a/f/unix.c b/f/unix.c index f12f0df0..c49d5bc2 100644 --- a/f/unix.c +++ b/f/unix.c @@ -306,9 +306,14 @@ u2_ux_fresh(const c3_c* paf_c, } else { if ( (stat(nom_c, &nom_stat) < 0) || +#ifdef U2_OS_linux + (nam_stat.st_mtime > nom_stat.st_mtime) +#else (nam_stat.st_mtimespec.tv_sec > nom_stat.st_mtimespec.tv_sec) || ((nam_stat.st_mtimespec.tv_sec == (nam_stat.st_mtimespec.tv_sec)) && - (nam_stat.st_mtimespec.tv_nsec > nom_stat.st_mtimespec.tv_nsec)) ) + (nam_stat.st_mtimespec.tv_nsec > nom_stat.st_mtimespec.tv_nsec)) +#endif + ) { return u2_no; } From 1ea9c7cee8d8ea1d64aca2c30f16b0d9853b3991 Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sat, 15 Oct 2011 02:48:26 -0500 Subject: [PATCH 5/5] ignore bin/* --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9a4daa16..ac701d36 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ generated run TAGS -.tags \ No newline at end of file +bin/* \ No newline at end of file