]> git.mdlowis.com Git - archive/afm.git/commitdiff
Fixed cross-platform issues on OSX and Linux, cygwin still up in the air
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 26 Jul 2014 01:04:03 +0000 (21:04 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 26 Jul 2014 01:04:03 +0000 (21:04 -0400)
Rakefile
source/main.c

index 24413c251879760600990e3e3eca82f725982b88..f3d8e46f2d87b769d93b0994b440cbf0088f3140 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -20,11 +20,28 @@ end
 # Build Environment
 #------------------------------------------------------------------------------
 Env = Rscons::Environment.new do |env|
+  env.build_dir('source','build/obj/source')
+  env.build_dir('modules','build/obj/modules')
+  env['LIBS'] = ['ncurses']
   env['CPPPATH'] += Dir['modules/data-structures/source/**/']
   #env['CFLAGS'] += ['-Wall']
-  env['CFLAGS'] += ['-Werror', '-pedantic', '--std=gnu99']
-  #env['CFLAGS'] += ['-D_GNU_SOURCE', '-D_XOPEN_SOURCE=700']
-  env['LIBS'] = ['ncurses']
+  env['CFLAGS'] += ['-Werror', '-pedantic', '--std=c99']
+
+  # Platform-specific Defines
+  # -------------------------
+  if RUBY_PLATFORM =~ /linux/
+    env['CFLAGS'] += [
+        '-D_GNU_SOURCE',
+        '-D_XOPEN_SOURCE=700'
+    ]
+  elsif RUBY_PLATFORM =~ /cygwin/
+    # TODO
+  elsif RUBY_PLATFORM =~ /darwin/
+    env['CFLAGS'] += [
+      '-D_DARWIN_C_SOURCE',
+      '-D__DARWIN_C_LEVEL=199506L'
+    ]
+  end
 end
 at_exit { Env.process }
 
index 665f9a713dc24ef9f2c1fffa45a0a0bedb12013d..23b1cf11ea7be24cddae20a799392bfe22e47b50 100644 (file)
 #include "workdir.h"
 
 void handle_signal(int sig) {
-    //signal(SIGWINCH, handle_signal);
     state_set_screen_dirty(true);
     state_set_screen_resized(true);
 }
 
 int main(int argc, char** argv) {
     /* Handle terminal resizing */
-    //signal(SIGWINCH, handle_signal);
+    signal(SIGWINCH, handle_signal);
     /* Initialize ncurses and user input settings */
     initscr();
     raw();