summaryrefslogtreecommitdiff
blob: ebe7dfc93ef7ce02d895deefd2013dadfb8747a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
--- a/jscalibrator/Makefile
+++ b/jscalibrator/Makefile
@@ -59,10 +59,7 @@
 #CFLAGS = -Wall -O -g \
 #         `gtk-config --cflags`
 
-CFLAGS = -Wall -O6 -fomit-frame-pointer -funroll-loops -ffast-math \
-         `gtk-config --cflags`
-
-CPPFLAGS = -D__cplusplus
+CPPFLAGS = 
 
 
 # ########################################################################
@@ -76,7 +73,7 @@
 #   to the LIB line depending on what you have set in the CFLAGS line
 #   farther above.
 #
-LIBS = -ljsw `gtk-config --libs`
+LIBS := -ljsw $(shell gtk-config --libs)
 
 # Library Directories:
 #
@@ -85,7 +82,7 @@
 #   Each argument is of the format -L<dir> where <dir> is the full
 #   path to the directory.
 #
-LIB_DIRS =
+LIB_DIRS = -L../libjsw
 
 # Header File Directories:
 #
@@ -95,7 +92,7 @@
 #   Each argument is of the format -I<dir> where <dir> is the full
 #   path to the directory.
 #
-INC_DIRS =
+INC_DIRS = $(shell gtk-config --cflags) -I../libjsw
 
 
 # ########################################################################
@@ -111,17 +108,13 @@
 RM      = rm
 RMFLAGS = -f
 
-CC  = cc
-CPP = c++
 BIN = jscalibrator
 OBJ_C   = $(SRC_C:.c=.o)
 OBJ_CPP = $(SRC_CPP:.cpp=.o)
 .c.o:
-	@echo "Compiling module $*.o"
-	@+$(CC) -c $*.c $(INC_DIRS) $(CFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INC_DIRS) -c $< -o $@
 .cpp.o:
-	@echo "Compiling module $*.o"
-	@+$(CPP) -c $*.cpp $(INC_DIRS) $(CFLAGS) $(CPPFLAGS)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INC_DIRS) -c $< -o $@
 
 
 # ########################################################################
@@ -130,10 +123,7 @@
 $(BIN): prebuild modules postbuild
 
 modules: $(OBJ_C) $(OBJ_CPP)
-	@echo  -n "Linking modules..."
-	@$(CC) $(OBJ_C) $(OBJ_CPP) -o $(BIN) $(LIBS) $(LIB_DIRS)
-	@echo -n "   "
-	@-$(LS) $(LSFLAGS) $(BIN)
+	$(CC) $(LDFLAGS) $(OBJ_C) $(OBJ_CPP) -o $(BIN) $(LIB_DIRS) $(LIBS)
 
 prebuild:
 	@echo "Building program \"$(BIN)\"..."
--- a/jswdemos/Makefile
+++ b/jswdemos/Makefile
@@ -1,5 +1,5 @@
 # Compiler flags
-CFLAGS = -g -O2 -Wall
+CFLAGS += -Wall
 
 # Libraries to link to
 LIB = -ljsw
@@ -10,10 +10,6 @@
 # Include paths
 INC_DIRS =
 
-# Compiler
-CC = gcc
-CPP = g++
-
 # Utilities
 RM      = rm
 RMFLAGS = -f
@@ -25,22 +21,23 @@
 
 axis:
 	@echo "Compiling program \"axis\""
-	@$(CC) axis.c -o axis $(CFLAGS) $(LIB) $(LIB_DIRS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) axis.c -o axis $(LIB) $(LIB_DIRS)
 
 basic:
 	@echo "Compiling program \"basic\""
-	@$(CC) basic.c -o basic $(CFLAGS) $(LIB) $(LIB_DIRS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) basic.c -o basic $(LIB) $(LIB_DIRS)
 
 button:
 	@echo "Compiling program \"button\""
-	@$(CC) button.c -o button $(CFLAGS) $(LIB) $(LIB_DIRS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) button.c -o button $(LIB) $(LIB_DIRS)
 
 listing:
 	@echo "Compiling program \"listing\""
-	@$(CC) listing.c -o listing $(CFLAGS) $(LIB) $(LIB_DIRS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) listing.c -o listing $(LIB) $(LIB_DIRS)
+
 waitbtn:
 	@echo "Compiling program \"waitbtn\""
-	@$(CC) waitbtn.c -o waitbtn $(CFLAGS) $(LIB) $(LIB_DIRS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) waitbtn.c -o waitbtn $(LIB) $(LIB_DIRS)
 
 # Clean up intermediate files
 clean:
--- a/libjsw/Makefile
+++ b/libjsw/Makefile
@@ -51,17 +51,15 @@
 #                               to debug the program.
 #
 
-CFLAGS = -Wall -O2 -g
-CFLAGS += -ffast-math
-
-CPPFLAGS = -D__cplusplus
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
 
 
 # ########################################################################
 # Dependant Libraries:
 #
 INC_DIRS =
-LIBS     = -shared
+LIBS     = -shared -Wl,-soname,libjsw.so.1
 LIB_DIRS =
 
 
@@ -76,18 +74,13 @@
 LS      = ls
 LSFLAGS = -s -h -c --color=auto
 
-CC  = cc
-CPP = c++
 LIB = $(LIBPFX).so.$(LIBVER)
 OBJ_C   = $(SRC_C:.c=.o)
 OBJ_CPP = $(SRC_CPP:.cpp=.o)
 .c.o:
-	@echo "Compiling module $*.o"
-	@+$(CC) -c $*.c $(INC_DIRS) $(CFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INC_DIRS) -c $< -o $@
 .cpp.o:
-	@echo "Compiling module $*.o"
-	@+$(CPP) -c $*.cpp $(INC_DIRS) $(CFLAGS) $(CPPFLAGS)
-
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INC_DIRS) -c $< -o $@
 
 # ########################################################################
 # Build Rules:
@@ -95,13 +88,7 @@
 $(LIB): prebuild modules postbuild
 
 modules: $(OBJ_C) $(OBJ_CPP)
-	@echo  -n "Linking modules..."
-	@$(CC) $(OBJ_C) $(OBJ_CPP) -Wl,-soname=$(LIB) -shared -o $(LIB) $(LIBS) $(LIB_DIRS)
-	@echo -n "   "
-	@$(RM) $(RMFLAGS) $(LIBPFX).so
-	@$(LINK) -s $(LIB) $(LIBPFX).so
-	@$(LINK) -s $(LIB) $(LIBPFX).so.1
-	@-$(LS) $(LSFLAGS) $(LIB)
+	$(CXX) $(LDFLAGS) $(OBJ_C) $(OBJ_CPP) -o $(LIB) $(LIBS) $(LIB_DIRS)
 
 prebuild:
 	@echo "Building library \"$(LIB)\"..."