Search our custom $(LIB_DIRS) path before the stuff 
gtk-config injects in $(LIBS).

http://bugs.gentoo.org/94867

Make sure we respect CFLAGS / CXXFLAGS

--- libjsw-1.5.5/jscalibrator/Makefile
+++ libjsw-1.5.5/jscalibrator/Makefile
@@ -59,8 +59,6 @@
 #CFLAGS = -Wall -O -g \
 #         `gtk-config --cflags`
 
-CFLAGS = -Wall -O6 -fomit-frame-pointer -funroll-loops -ffast-math \
-         `gtk-config --cflags`
 
 CPPFLAGS = -D__cplusplus
 
@@ -76,7 +74,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 +83,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 +93,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
 
 
 # ########################################################################
@@ -117,11 +115,9 @@
 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) -c $*.c $(INC_DIRS) $(CFLAGS)
 .cpp.o:
-	@echo "Compiling module $*.o"
-	@+$(CPP) -c $*.cpp $(INC_DIRS) $(CFLAGS) $(CPPFLAGS)
+	$(CPP) -c $*.cpp $(INC_DIRS) $(CXXFLAGS) $(CPPFLAGS)
 
 
 # ########################################################################
@@ -130,10 +126,7 @@
 $(BIN): prebuild modules postbuild
 
 modules: $(OBJ_C) $(OBJ_CPP)
-	@echo  -n "Linking modules..."
-	@$(CPP) $(OBJ_C) $(OBJ_CPP) -o $(BIN) $(LIBS) $(LIB_DIRS)
-	@echo -n "   "
-	@-$(LS) $(LSFLAGS) $(BIN)
+	$(CPP) $(OBJ_C) $(OBJ_CPP) -o $(BIN) $(LDFLAGS) $(LIB_DIRS) $(LIBS)
 
 prebuild:
 	@echo "Building program \"$(BIN)\"..."
--- libjsw-1.5.5/libjsw/Makefile
+++ libjsw-1.5.5/libjsw/Makefile
@@ -51,11 +51,10 @@
 #                               to debug the program.
 #
 
-CFLAGS = -Wall -O6 \
-         -fomit-frame-pointer -funroll-loops -ffast-math \
-         -finline-functions
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
 
-CPPFLAGS = -D__cplusplus
+CPPFLAGS += -D__cplusplus
 
 
 # ########################################################################
@@ -83,11 +82,9 @@
 OBJ_C   = $(SRC_C:.c=.o)
 OBJ_CPP = $(SRC_CPP:.cpp=.o)
 .c.o:
-	@echo "Compiling module $*.o"
-	@+$(CC) -c $*.c $(INC) $(CFLAGS)
+	$(CC) -c $*.c $(INC) $(CFLAGS)
 .cpp.o:
-	@echo "Compiling module $*.o"
-	@+$(CPP) -c $*.cpp $(INC) $(CFLAGS) $(CPPFLAGS)
+	$(CPP) -c $*.cpp $(INC) $(CXXFLAGS) $(CPPFLAGS)
 
 
 # ########################################################################
@@ -96,10 +93,7 @@
 $(LIB): prebuild modules postbuild
 
 modules: $(OBJ_C) $(OBJ_CPP)
-	@echo  -n "Linking modules..."
-	@$(CPP) $(OBJ_C) $(OBJ_CPP) -o $(LIB) $(LIBS) $(LIB_DIRS)
-	@echo -n "   "
-	@-$(LS) $(LSFLAGS) $(LIB)
+	$(CPP) $(OBJ_C) $(OBJ_CPP) -o $(LIB) $(LDFLAGS) $(LIBS) $(LIB_DIRS)
 
 prebuild:
 	@echo "Building library \"$(LIB)\"..."