git.haldean.org ana / 418320c
make-based build system (tup is a headache) Haldean Brown 2 years ago
4 changed file(s) with 88 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
00 build
11 *.o
2 .tup
2 *.d
0 cxx_sources = \
1 src/ana.cpp \
2 src/node.cpp \
3 src/reallocarray.cpp \
4 src/shaders.cpp \
5 src/ui.cpp \
6 lib/imgui/imgui.cpp \
7 lib/imgui/imgui_draw.cpp \
8 lib/imgui/imgui_widgets.cpp \
9 lib/imgui/examples/imgui_impl_opengl3.cpp \
10 lib/imgui/examples/imgui_impl_glfw.cpp
11
12 objects = $(patsubst %.cpp,%.o,$(cxx_sources))
13 deps = $(patsubst %.cpp,%.d,$(c_sources))
14
15 CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
16 CXXFLAGS += -I lib/imgui
17 CXXFLAGS += -I lib/imgui/examples
18 CXXFLAGS += -I lib/glew-2.1.0/include
19 CXXFLAGS += -I lib/glfw-3.2.1.bin.WIN64/include
20 CXXFLAGS += -I lib/glm
21 CXXFLAGS += -MD
22
23 LDFLAGS += lib\glew-2.1.0\lib\Release\x64\glew32.lib
24 LDFLAGS += lib\glfw-3.2.1.bin.WIN64\lib-mingw-w64\libglfw3.a
25 LDFLAGS += -lopengl32
26 LDFLAGS += -lgdi32
27 LDFLAGS += -lglu32
28 LDFLAGS += -lshell32
29
30 dist: build/ana.exe build/glew32.dll
31
32 build/glew32.dll: lib/glew-2.1.0/bin/Release/x64/glew32.dll
33 cp $< $@
34
35 build/ana.exe: $(objects)
36 mkdir -p build
37 $(CXX) $(objects) $(LDFLAGS) -o $@
38
39 -include $(patsubst %.o,%.d,$(objects))
40
41 clean:
42 rm -rf $(objects) build
43 .PHONY: clean
+0
-43
src/reallocarray.c less more
0 /* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
1 /*
2 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /* if this is defined, then we already have an implementation of reallocarray available */
18 #ifndef _GNU_SOURCE
19
20 #include <sys/types.h>
21 #include <errno.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24
25 /*
26 * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
27 * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
28 */
29 #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
30
31 void *
32 reallocarray(void *optr, size_t nmemb, size_t size)
33 {
34 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
35 nmemb > 0 && SIZE_MAX / nmemb < size) {
36 errno = ENOMEM;
37 return NULL;
38 }
39 return realloc(optr, size * nmemb);
40 }
41
42 #endif
0 /* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
1 /*
2 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /* if this is defined, then we already have an implementation of reallocarray available */
18 #ifndef _GNU_SOURCE
19
20 #include <sys/types.h>
21 #include <errno.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24
25 /*
26 * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
27 * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
28 */
29 #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
30
31 void *
32 reallocarray(void *optr, size_t nmemb, size_t size)
33 {
34 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
35 nmemb > 0 && SIZE_MAX / nmemb < size) {
36 errno = ENOMEM;
37 return NULL;
38 }
39 return realloc(optr, size * nmemb);
40 }
41
42 #endif