diff --git a/Makefile b/Makefile index 5847399..7663b42 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ # Options (e.g. `CFLAGS=-DHAVE_ARGP make`) # HAVE_ARGP: use `argp` for argument parsing. -VERSION ?= 9.0.1 - prefix ?= /usr/local exec_prefix ?= $(prefix) bindir ?= $(exec_prefix)/bin @@ -19,7 +17,6 @@ RM ?= rm -f CPPFLAGS := \ -D_FORTIFY_SOURCE=2 \ - -DVERSION=$(VERSION) \ $(CPPFLAGS) OFLAGS := -O3 \ -falign-functions=1 \ diff --git a/glxgears.c b/glxgears.c index fdd1f90..7c71808 100644 --- a/glxgears.c +++ b/glxgears.c @@ -186,7 +186,7 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; static GLint gear1, gear2, gear3; static GLfloat angle = 0.0; -static void cleanup(void) { +static void __attribute__((noreturn)) cleanup(void) { glDeleteLists(gear1, 1); glDeleteLists(gear2, 1); glDeleteLists(gear3, 1); @@ -380,6 +380,7 @@ static char *window_title = "Gears"; #ifdef HAVE_ARGP static const struct argp_option options[] = { + {"version", 'V', 0, 0, "print program version"}, {"info", 256, 0, 0, "Display OpenGL renderer information"}, {"exit", 257, 0, 0, "Automatically exit after 30 seconds"}, {"noanim", 258, 0, 0, "Don't start animation"}, @@ -393,6 +394,9 @@ static const struct argp_option options[] = { static error_t parse_opt(int key, char *val, struct argp_state *) { switch (key) { + case 'V': + printf("glxgears 9.0.1\n"); + exit(EXIT_SUCCESS); case 256: print_glinfo = GL_TRUE; break; @@ -434,12 +438,12 @@ static void parse_args(int argc, char *argv[]) { #endif int main(int argc, char *argv[]) { - glutInit(&argc, argv); #ifdef HAVE_ARGP argp_parse(&argp, argc, argv, ARGP_LONG_ONLY, 0, 0); #else parse_args(argc, argv); #endif + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); win = glutCreateWindow(window_title); init_scene();