We use glXGetProcAddress to load glXCreateContextAttribsARB ourselves,
so GLX_GLXEXT_PROTOTYPES is not needed.
... | ... |
@@ -9,6 +9,7 @@ else ifeq ($(shell uname),Darwin) |
9 | 9 |
MICROGLUT = MicroGlut.m |
10 | 10 |
endif |
11 | 11 |
|
12 |
+PROG = tsbk07 |
|
12 | 13 |
COMMON = \ |
13 | 14 |
common/GL_utilities.c \ |
14 | 15 |
common/LoadTGA.c \ |
... | ... |
@@ -35,9 +36,9 @@ LDLIBS += \ |
35 | 36 |
$(LDLIBS_$(OS)) |
36 | 37 |
|
37 | 38 |
# The below is equivalent to the GNU Make implicit rule for |
38 |
-# tsbk07: $(COMMON) |
|
39 |
-tsbk07: tsbk07.cpp $(COMMON) |
|
40 |
- g++ $(CXXFLAGS) $(CPPFLAGS) tsbk07.cpp $(COMMON) $(LDLIBS) -o tsbk07 |
|
39 |
+# $(PROG): $(COMMON) |
|
40 |
+$(PROG): $(PROG).cpp $(COMMON) |
|
41 |
+ g++ $(CXXFLAGS) $(CPPFLAGS) $(PROG).cpp $(COMMON) $(LDLIBS) -o $(PROG) |
|
41 | 42 |
|
42 | 43 |
clean: |
43 |
- rm tsbk07 |
|
44 |
+ rm $(PROG) |
The main rule is now equivalent to a GNU Make implicit rule which is a
good indication that it follows best practices.
... | ... |
@@ -28,12 +28,12 @@ LDLIBS_Mac += \ |
28 | 28 |
-framework Cocoa \ |
29 | 29 |
-framework OpenGL |
30 | 30 |
LDLIBS += \ |
31 |
- $(LDLIBS_$(OS)) \ |
|
32 |
- -lm \ |
|
33 |
- -lstdc++ |
|
31 |
+ $(LDLIBS_$(OS)) |
|
34 | 32 |
|
33 |
+# The below is equivalent to the GNU Make implicit rule for |
|
34 |
+# tsbk07: $(COMMON) |
|
35 | 35 |
tsbk07: tsbk07.cpp $(COMMON) |
36 |
- gcc $(CXXFLAGS) -o tsbk07 $(CPPFLAGS) tsbk07.cpp $(COMMON) $(LDLIBS) |
|
36 |
+ g++ $(CXXFLAGS) $(CPPFLAGS) tsbk07.cpp $(COMMON) $(LDLIBS) -o tsbk07 |
|
37 | 37 |
|
38 | 38 |
clean: |
39 | 39 |
rm tsbk07 |
... | ... |
@@ -1,17 +1,35 @@ |
1 |
+ifeq ($(OS),Windows_NT) |
|
2 |
+ OS = Windows |
|
3 |
+ MICROGLUT = MicroGlut.c |
|
4 |
+else ifeq ($(shell uname),Linux) |
|
5 |
+ OS = Linux |
|
6 |
+ MICROGLUT = MicroGlut.c |
|
7 |
+else ifeq ($(shell uname),Darwin) |
|
8 |
+ OS = Mac |
|
9 |
+ MICROGLUT = MicroGlut.m |
|
10 |
+endif |
|
11 |
+ |
|
1 | 12 |
COMMON = \ |
2 | 13 |
common/GL_utilities.c \ |
3 | 14 |
common/LoadTGA.c \ |
4 |
- common/Linux/MicroGlut.c |
|
15 |
+ common/$(OS)/$(MICROGLUT) |
|
5 | 16 |
CPPFLAGS += \ |
6 | 17 |
-Icommon \ |
7 |
- -Icommon/Linux \ |
|
18 |
+ -Icommon/$(OS) \ |
|
8 | 19 |
-DGL_GLEXT_PROTOTYPES |
9 | 20 |
CXXFLAGS += \ |
10 | 21 |
-Wall |
11 |
-LDLIBS += \ |
|
22 |
+LDLIBS_Windows += \ |
|
23 |
+ -lopengl32 |
|
24 |
+LDLIBS_Linux += \ |
|
12 | 25 |
-lXt \ |
13 | 26 |
-lX11 \ |
14 |
- -lGL \ |
|
27 |
+ -lGL |
|
28 |
+LDLIBS_Mac += \ |
|
29 |
+ -framework Cocoa \ |
|
30 |
+ -framework OpenGL |
|
31 |
+LDLIBS += \ |
|
32 |
+ $(LDLIBS_$(OS)) \ |
|
15 | 33 |
-lm \ |
16 | 34 |
-lstdc++ |
17 | 35 |
|
... | ... |
@@ -1,11 +1,22 @@ |
1 |
-# set this variable to the director in which you saved the common files |
|
2 |
-commondir = common/ |
|
1 |
+COMMON = \ |
|
2 |
+ common/GL_utilities.c \ |
|
3 |
+ common/LoadTGA.c \ |
|
4 |
+ common/Linux/MicroGlut.c |
|
5 |
+CPPFLAGS += \ |
|
6 |
+ -Icommon \ |
|
7 |
+ -Icommon/Linux \ |
|
8 |
+ -DGL_GLEXT_PROTOTYPES |
|
9 |
+CXXFLAGS += \ |
|
10 |
+ -Wall |
|
11 |
+LDLIBS += \ |
|
12 |
+ -lXt \ |
|
13 |
+ -lX11 \ |
|
14 |
+ -lGL \ |
|
15 |
+ -lm \ |
|
16 |
+ -lstdc++ |
|
3 | 17 |
|
4 |
-all : tsbk07 |
|
18 |
+tsbk07: tsbk07.cpp $(COMMON) |
|
19 |
+ gcc $(CXXFLAGS) -o tsbk07 $(CPPFLAGS) tsbk07.cpp $(COMMON) $(LDLIBS) |
|
5 | 20 |
|
6 |
-tsbk07 : tsbk07.cpp $(commondir)GL_utilities.c $(commondir)LoadTGA.c $(commondir)Linux/MicroGlut.c |
|
7 |
- gcc -Wall -o tsbk07 -I$(commondir) -Icommon/Linux -DGL_GLEXT_PROTOTYPES tsbk07.cpp $(commondir)GL_utilities.c $(commondir)LoadTGA.c $(commondir)Linux/MicroGlut.c -lXt -lX11 -lGL -lm -lstdc++ |
|
8 |
- |
|
9 |
-clean : |
|
21 |
+clean: |
|
10 | 22 |
rm tsbk07 |
11 |
- |
This is the most common traditional name.
Robert Cranston authored on 27/02/2024 02:27:391 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
1 |
+# set this variable to the director in which you saved the common files |
|
2 |
+commondir = common/ |
|
3 |
+ |
|
4 |
+all : tsbk07 |
|
5 |
+ |
|
6 |
+tsbk07 : tsbk07.cpp $(commondir)GL_utilities.c $(commondir)LoadTGA.c $(commondir)Linux/MicroGlut.c |
|
7 |
+ gcc -Wall -o tsbk07 -I$(commondir) -Icommon/Linux -DGL_GLEXT_PROTOTYPES tsbk07.cpp $(commondir)GL_utilities.c $(commondir)LoadTGA.c $(commondir)Linux/MicroGlut.c -lXt -lX11 -lGL -lm -lstdc++ |
|
8 |
+ |
|
9 |
+clean : |
|
10 |
+ rm tsbk07 |
|
11 |
+ |