Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated with triffid_hunters feedback. Removed MAP_CACHED...single ma…

…kefile
  • Loading branch information...
commit 38a874a32a62ed330f91c4024d24ed5c3762010f 1 parent 3abab7d
@ceterumnet authored
Showing with 18 additions and 118 deletions.
  1. +0 −79 .project
  2. +16 −5 Makefile
  3. +0 −27 Makefile.osx
  4. +2 −7 main.c
View
79 .project
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>gcodeview</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
- <triggers>clean,full,incremental,</triggers>
- <arguments>
- <dictionary>
- <key>?name?</key>
- <value></value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.append_environment</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
- <value>all</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.buildArguments</key>
- <value></value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.buildCommand</key>
- <value>make</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
- <value>clean</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.contents</key>
- <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
- <value>false</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableFullBuild</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
- <value>all</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.stopOnError</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
- <value>true</value>
- </dictionary>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
- <triggers>full,incremental,</triggers>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.cdt.core.cnature</nature>
- <nature>org.eclipse.cdt.core.ccnature</nature>
- <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
- <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
- </natures>
-</projectDescription>
View
21 Makefile
@@ -1,11 +1,21 @@
-EXECUTABLE = gcodeview
+ifneq ($(wildcard /System/Library/Extensions/AppleFileSystemDriver.kext),)
+ OSTYPE=darwin
+endif
-LIBS = sdl ftgl fontconfig gl freetype2
+LIBS = sdl ftgl fontconfig
+CFLAGS = -O$(OPTIMIZE) -std=c99 -Wall `pkg-config --cflags $(LIBS)`
+LDFLAGS = `pkg-config --libs $(LIBS)`
-OPTIMIZE = 2
+ifeq ($(OSTYPE),darwin)
+ LIBS += freetype2
+ LDFLAGS += -lm -framework OpenGL
+else
+ LIBS += gl
+endif
-CFLAGS = -O$(OPTIMIZE) -std=c99 -Wall `pkg-config --cflags $(LIBS)`
-LDFLAGS = `pkg-config --libs $(LIBS)` -lm
+EXECUTABLE = gcodeview
+
+OPTIMIZE = 2
SOURCES = main.c
OBJECTS = $(SOURCES:.c=.o)
@@ -16,6 +26,7 @@ all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
+ @echo Building for [$(OSTYPE)].
%.o: %.c
$(CC) $(CFLAGS) -std=c99 -c $< -o $@
View
27 Makefile.osx
@@ -1,27 +0,0 @@
-EXECUTABLE = gcodeview
-
-LIBS = sdl ftgl fontconfig freetype2
-
-OPTIMIZE = 2
-
-CFLAGS = -O$(OPTIMIZE) -std=c99 -Wall `pkg-config --cflags $(LIBS)`
-LDFLAGS = `pkg-config --libs $(LIBS)` -lm -framework OpenGL
-
-SOURCES = main.c
-OBJECTS = $(SOURCES:.c=.o)
-
-
-
-.PHONY: all clean
-
-all: $(SOURCES) $(EXECUTABLE)
- @echo The OS environment variable is set to [$(OS)].
-
-$(EXECUTABLE): $(OBJECTS)
- $(CC) $(OBJECTS) $(LDFLAGS) -o $@
-
-%.o: %.c
- $(CC) $(CFLAGS) -std=c99 -c $< -o $@
-
-clean:
- rm $(OBJECTS) $(EXECUTABLE)
View
9 main.c
@@ -446,13 +446,8 @@ void resize(int w, int h) {
SDL_FreeSurface(Surf_Display);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-#ifdef __linux__
- Surf_Display = SDL_SetVideoMode(Surf_width, Surf_height, 32, SDL_HWSURFACE | SDL_RESIZABLE | SDL_OPENGL);
-#endif
-#ifdef __APPLE__
- Surf_Display = SDL_SetVideoMode( Surf_width, Surf_height, 0, SDL_OPENGL | SDL_HWSURFACE | SDL_RESIZABLE);
-#endif
+ Surf_Display = SDL_SetVideoMode(Surf_width, Surf_height, 0, SDL_HWSURFACE | SDL_RESIZABLE | SDL_OPENGL);
w = Surf_Display->w; h = Surf_Display->h;
glViewport(0, 0, w, h);
@@ -874,7 +869,7 @@ int main(int argc, char* argv[]) {
gcodefile = mmap(NULL, filesz, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fd, 0);
#endif
#ifdef __APPLE__
- gcodefile = mmap(NULL, filesz, PROT_READ, MAP_FILE|MAP_PRIVATE|MAP_NOCACHE, fd, 0);
+ gcodefile = mmap(NULL, filesz, PROT_READ, MAP_PRIVATE, fd, 0);
#endif
if (gcodefile == MAP_FAILED)

0 comments on commit 38a874a

Please sign in to comment.
Something went wrong with that request. Please try again.