Permalink
Browse files

Tidy up Makefiles.

Suppress warnings from swig generated code.
Specify libstc++ for compilation under clang.
  • Loading branch information...
1 parent 9ebf4cd commit 7f8df55d3f8c9047f81ca1fdf67c504a4ef0a4d6 @9thbit 9thbit committed Dec 12, 2013
@@ -109,47 +109,50 @@ $(PYTHON):
@mkdir -p $(PYTHON)
# ------------------------------------------------------------
-clean_swig:
- rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
+clean_swig:
+ @echo "-> cleaning swig interface"
+ @rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
-clean :
- rm -rf $(OBJ)/*.o $(OBJ)/*.a $(SRC)/*~ $(MOD)/obj/*.o $(MOD)/src/*~ $(MOD)/src/*/*~ $(INC)/*~ *~ $(BIN)/*
+clean:
+ @echo "-> cleaning"
+ @rm -rf $(OBJ)/*.o $(OBJ)/*.a $(SRC)/*~ $(MOD)/obj/*.o $(MOD)/src/*~ $(MOD)/src/*/*~ $(INC)/*~ *~ $(BIN)/*
install_python: wrapper
cd $(PYTHON); python $(MAINDIR)/tools/setup.py install
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
- @echo "-> compiling $@"
- $(CCC) $(CFLAGS) -c -o $@ $<
+ @echo "-> compiling $@"
+ @$(CCC) $(CFLAGS) -c -o $@ $<
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
- @echo "-> compiling $@"
- $(CCC) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -c $< -o $@
+ @echo "-> compiling $@"
+ @$(CCC) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
- $(SWIG) -c++ -python $<
- python $(MAINDIR)/tools/finalize.py $(<:.i=.py)
+ @$(SWIG) -c++ -python $<
+ @python $(MAINDIR)/tools/finalize.py $(<:.i=.py)
$(PYTHON)/%.i: $(SRCDIR)/%.hpp
- python $(MAINDIR)/tools/mk_interface.py $<
+ @echo "-> creating interface $@"
+ @python $(MAINDIR)/tools/mk_interface.py $<
$(PYTHON)/_%.so: $(OBJDIR)/%.o $(PYTHON)/%_wrap.o $(PLIBOBJ)
@echo "-> linking $@"
- $(CCC) $(BUNDLE) -Wno-long-double $(CFLAGS) $(LFLAGS) $(AUXOBJFILES) $(MAINOBJFILES) $(PLIBOBJ) python/$(MAINNAME)_wrap.o -o $@
+ @$(CCC) $(BUNDLE) -Wno-long-double $(CFLAGS) $(LFLAGS) $(AUXOBJFILES) $(MAINOBJFILES) $(PLIBOBJ) python/$(MAINNAME)_wrap.o -o $@
# The library
lib: $(PLIBOBJ)
$(OBJ)/%.o: $(SRC)/%.cpp $(INC)/%.h
- $(CCC) $(CFLAGS) -c $< -o $@
+ @$(CCC) $(CFLAGS) -c $< -o $@
# The examples
$(BIN)/%: $(MOD)/obj/%.o $(PLIBOBJ)
- $(CCC) $(CFLAGS) $< $(PLIBOBJ) -lm -o $@ $(LFLAGS)
+ @$(CCC) $(CFLAGS) $< $(PLIBOBJ) -lm -o $@ $(LFLAGS)
%: $(MOD)/obj/%.o $(PLIBOBJ)
- $(CCC) $(CFLAGS) $< $(PLIBOBJ) -lm -o $(BIN)/$@ $(LFLAGS)
+ @$(CCC) $(CFLAGS) $< $(PLIBOBJ) -lm -o $(BIN)/$@ $(LFLAGS)
$(MOD)/obj/%.o: $(MOD)/src/%.cpp
- $(CCC) -c $(CFLAGS) -o $@ $<
+ @$(CCC) -c $(CFLAGS) -o $@ $<
@@ -14,7 +14,7 @@ PYLIB = `python-config --cflags`
PYOBJ = `python-config --prefix`
-CPLEXCCFLAGS = `python $(MAINDIR)/tools/solverconfig.py CPLEX cflags`
+CPLEXCCFLAGS = `python $(MAINDIR)/tools/solverconfig.py CPLEX cflags` -Wno-unused-private-field
CPLEXLDFLAGS = `python $(MAINDIR)/tools/solverconfig.py CPLEX lflags`
@@ -79,7 +79,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
@echo "-> compiling $@"
- @$(CCC) $(OPTFLAGS) $(COMPILFLAGS) $(CFLAGS) $(PYLIB) -I$(SRCDIR) -c $< -o $@
+ @$(CCC) $(PYLIB) $(OPTFLAGS) $(COMPILFLAGS) $(CFLAGS) -I$(SRCDIR) -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
@@ -88,7 +88,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
@echo "-> compiling $@"
- @$(CXX) $(CFLAGS) $(PYLIB) -fPIC -c $< -o $@
+ @$(CXX) $(PYLIB) $(CFLAGS) -fPIC -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
@@ -74,6 +74,7 @@ SOFILE = $(PYTHON)/_$(MAINNAME).so
MIPDIR = $(MAINDIR)/solvers/mip
MIPFLAGS = -I$(MIPDIR)/src/
+CXXFLAGS += $(CFLAGS)
#-----------------------------------------------------------------------------
@@ -120,7 +121,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
@echo "-> compiling $@"
- @$(CXX) $(MIPFLAGS) $(NFLAGS) $(OFLAGS) $(BINOFLAGS) $(CXXFLAGS) $(PYLIB) -fPIC -c $< $(CXX_o)$@
+ @$(CXX) $(PYLIB) $(MIPFLAGS) $(NFLAGS) $(OFLAGS) $(BINOFLAGS) $(CXXFLAGS) -fPIC -c $< $(CXX_o)$@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
View
@@ -28,6 +28,10 @@ PYVERSION := $(shell python -V 2>&1 | \
ifeq ($(OSTYPE),darwin)
BUNDLE = -bundle -undefined suppress
CFLAGS += -flat_namespace
+CFLAGS += -stdlib=libstdc++
+CFLAGS += -Wno-self-assign -Wno-shadow # ignore warnings about swig generated code
+CFLAGS += -Qunused-arguments # tell clang to ignore some gcc flags we use
+
else
BUNDLE = -shared
endif
@@ -51,7 +51,7 @@ SOFILE = $(PYTHON)/_$(MAINNAME).so
SATDIR = $(MAINDIR)/solvers/sat
MTL = $(SATDIR)/minisat_src/mtl
CORE = $(SATDIR)/minisat_src/core
-CFLAGS += -I$(SATDIR)/src/ -I$(MTL) $(HACK) -I$(CORE) -Wall -ffloat-store -O3 # -DNDEBUG
+CFLAGS += -I$(SATDIR)/src/ -I$(MTL) $(HACK) -I$(CORE) -ffloat-store -O3 # -DNDEBUG
#LFLAGS = -lz
@@ -64,7 +64,7 @@ CXX = g++ #-g -D_DEBUGWRAP
wrapper: $(OBJDIR) $(PYTHON) $(SATDIR)/$(OBJDIR) $(IFILE) $(WXXFILE) $(SOFILE) $(OBJDIR)/MiniSat.o
-debug: CFLAGS += -D_DEBUGWRAP -g
+debug: CFLAGS += -D_DEBUGWRAP -g -Wall
debug: wrapper
$(OBJDIR):
@@ -106,7 +106,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
@echo "-> compiling $@"
- @$(CXX) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -fPIC -c $< -o $@
+ @$(CXX) $(PYLIB) $(CFLAGS) -I$(SRCDIR) -fPIC -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
@@ -34,7 +34,7 @@ WOBFILE = $(PYTHON)/$(MAINNAME)_wrap.o
SOFILE = $(PYTHON)/_$(MAINNAME).so
-CFLAGS += -Wall -ffloat-store -O3
+CFLAGS += -ffloat-store -O3
#-----------------------------------------------------------------------------
# Rules
@@ -45,7 +45,7 @@ CXX ?= g++
wrapper: $(OBJDIR) $(PYTHON) $(IFILE) $(WXXFILE) $(SOFILE) $(OBJDIR)/MipWrapper.o
-debug: CFLAGS += -D_DEBUGWRAP -g
+debug: CFLAGS += -D_DEBUGWRAP -g -Wall
debug: wrapper $(MAINOBJFILES) $(WOBFILE)
$(OBJDIR):
@@ -73,7 +73,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
@echo "-> compiling $@"
- @$(CXX) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -fPIC -c $< -o $@
+ @$(CXX) $(PYLIB) $(CFLAGS) -I$(SRCDIR) -fPIC -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
@@ -108,11 +108,13 @@ PLIBOBJ = $(patsubst $(SRC)/%, $(OBJ)/%, $(PLIBAUX))
wrapper: $(OBJDIR) $(PYTHON) $(IFILE) $(WXXFILE) $(SOFILE)
# ------------------------------------------------------------
-clean_swig:
- rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
+clean_swig:
+ @echo "-> cleaning swig interface"
+ @rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
-clean :
- rm -rf $(OBJ)/*.o $(OBJ)/*.a $(SRC)/*~ $(MOD)/obj/*.o $(MOD)/src/*~ $(MOD)/src/*/*~ $(INC)/*~ *~ $(BIN)/*
+clean:
+ @echo "-> cleaning"
+ @rm -rf $(OBJ)/*.o $(OBJ)/*.a $(SRC)/*~ $(MOD)/obj/*.o $(MOD)/src/*~ $(MOD)/src/*/*~ $(INC)/*~ *~ $(BIN)/*
$(OBJDIR):
@-mkdir -p $(OBJDIR)
@@ -124,29 +126,30 @@ install_python: wrapper
cd $(PYTHON); python $(MAINDIR)/tools/setup.py install
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
- @echo "-> compiling $@"
- $(CCC) $(CFLAGS) $(MCFLAGS) -c -o $@ $<
+ @echo "-> compiling $@"
+ @$(CCC) $(CFLAGS) $(MCFLAGS) -c -o $@ $<
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
- @echo "-> compiling $@"
- $(CCC) $(CFLAGS) $(MCFLAGS) -I$(SRCDIR) $(PYLIB) -c $< -o $@
+ @echo "-> compiling $@"
+ @$(CCC) $(CFLAGS) $(MCFLAGS) -I$(SRCDIR) $(PYLIB) -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
- $(SWIG) -c++ -python $<
- python $(MAINDIR)/tools/finalize.py $(<:.i=.py)
+ @$(SWIG) -c++ -python $<
+ @python $(MAINDIR)/tools/finalize.py $(<:.i=.py)
$(PYTHON)/%.i: $(SRCDIR)/%.hpp
- python $(MAINDIR)/tools/mk_interface.py $<
+ @echo "-> creating interface $@"
+ @python $(MAINDIR)/tools/mk_interface.py $<
$(PYTHON)/_%.so: $(OBJDIR)/%.o $(PYTHON)/%_wrap.o $(PLIBOBJ)
@echo "-> linking $@"
- $(CCC) $(BUNDLE) -Wno-long-double $(CFLAGS) $(LFLAGS) $(MCFLAGS) $(MLFLAGS) $(AUXOBJFILES) $(MAINOBJFILES) $(PLIBOBJ) python/$(MAINNAME)_wrap.o -o $@
+ @$(CCC) $(BUNDLE) -Wno-long-double $(CFLAGS) $(LFLAGS) $(MCFLAGS) $(MLFLAGS) $(AUXOBJFILES) $(MAINOBJFILES) $(PLIBOBJ) python/$(MAINNAME)_wrap.o -o $@
# The library
lib: $(PLIBOBJ) $(PUTIOBJ)
$(OBJ)/%.o: $(SRC)/%.cpp $(INC)/%.hpp
@echo 'compile '$<
- $(CCC) $(MCFLAGS) -c $< -o $@
+ $(CCC) $(CFLAGS) $(MCFLAGS) -c $< -o $@
View
@@ -39,7 +39,7 @@ SOFILE = $(PYTHON)/_$(MAINNAME).so
MCORE = minisat_src/core
MTL = minisat_src/mtl
-CFLAGS += -I$(MCORE) -I$(MTL) $(HACK) -Wall -ffloat-store -O3 # -DNDEBUG
+CFLAGS += -I$(MCORE) -I$(MTL) $(HACK) -ffloat-store -O3 # -DNDEBUG
#-----------------------------------------------------------------------------
# Rules
@@ -50,7 +50,7 @@ CXX = g++
wrapper: $(OBJDIR) $(PYTHON) $(IFILE) $(WXXFILE) $(SOFILE) $(OBJDIR)/SatWrapper.o
-debug: CFLAGS += -D_DEBUGWRAP -g
+debug: CFLAGS += -D_DEBUGWRAP -g -Wall
debug: wrapper
$(OBJDIR):
@@ -74,12 +74,12 @@ clean:
@-rm -rf $(OBJDIR)/* $(PYTHON)/*o $(PYTHON)/*~ $(PYTHON)/build *~ $(SRCDIR)/*~
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
- @echo "-> compiling $@"
- @$(CXX) $(CFLAGS) -fPIC -c -o $@ $<
+ @echo "-> compiling $@"
+ @$(CXX) $(CFLAGS) -fPIC -c -o $@ $<
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
- @echo "-> compiling $@"
- @$(CXX) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -fPIC -c $< -o $@
+ @echo "-> compiling $@"
+ @$(CXX) $(PYLIB) $(CFLAGS) -I$(SRCDIR) -fPIC -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
@@ -46,17 +46,23 @@ SATDIR = $(MAINDIR)/solvers/sat
MCORE = $(MAINDIR)/solvers/sat/minisat_src/core
MTL = $(MAINDIR)/solvers/sat/minisat_src/mtl
WALKSRC = $(MAINDIR)/solvers/sat/walksat_src
-CFLAGS += -I$(MCORE) -I$(MTL) -I$(SATDIR)/src/ -I$(WALKSRC) $(HACK) -Wall -ffloat-store -O3 #-DNDEBUG -D_DEBUGWRAP
+CFLAGS += -I$(MCORE) -I$(MTL) -I$(SATDIR)/src/ -I$(WALKSRC) $(HACK) -ffloat-store -O3 #-DNDEBUG -D_DEBUGWRAP
+# Ignore warnings generated from a solver's source which are out of our control
+IGNOREFLAGS = -Wno-unused-variable -Wno-format
#-----------------------------------------------------------------------------
# Rules
#-----------------------------------------------------------------------------
-CXX = g++ #-g -D_DEBUGWRAP
+CXX = g++
-wrapper: $(OBJDIR) $(PYTHON) $(IFILE) $(WXXFILE) $(SOFILE) $(OBJDIR)/Walksat.o
+wrapper: $(OBJDIR) $(PYTHON) $(IFILE) $(WXXFILE) $(SOFILE) $(OBJDIR)/Walksat.o
+
+debug: CFLAGS += -D_DEBUGWRAP -g -Wall
+debug: wrapper
+
$(OBJDIR):
@mkdir -p $(OBJDIR)
@@ -65,46 +71,48 @@ $(PYTHON):
@mkdir -p $(PYTHON)
$(WALKSRC)/%.o: $(WALKSRC)/%.cpp
- @echo Compiling: "$@ ( $< )"
- gcc $(CFLAGS) -fPIC -c -o $@ $<
+ @echo "-> compiling $@ ( $< )"
+ @$(CXX) $(CFLAGS) $(IGNOREFLAGS) -fPIC -c -o $@ $<
$(SATDIR)/obj/%.o: $(SATDIR)/src/%.cpp
- @echo Compiling: "$@ ( $< )"
- gcc $(CFLAGS) -fPIC -c -o $@ $<
+ @echo "-> compiling $@ ( $< )"
+ @$(CXX) $(CFLAGS) $(IGNOREFLAGS) -fPIC -c -o $@ $<
install_python: wrapper
cd $(PYTHON); python $(MAINDIR)/tools/setup.py install
clean_swig:
- -rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
+ @echo "-> cleaning swig interface"
+ @-rm -rf $(OBJDIR)/* $(PYTHON)/* *~ $(SRCDIR)/*~
clean_all: clean clean_swig
cd $(CORE)/; make clean
-
clean:
- -rm -rf $(OBJDIR)/* $(PYTHON)/*o $(PYTHON)/*~ $(PYTHON)/build *~ $(SRCDIR)/*~
+ @echo "-> cleaning"
+ @-rm -rf $(OBJDIR)/* $(PYTHON)/*o $(PYTHON)/*~ $(PYTHON)/build *~ $(SRCDIR)/*~
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
- @echo "-> compiling $@"
- $(CXX) $(CFLAGS) -fPIC -c -o $@ $<
+ @echo "-> compiling $@"
+ @$(CXX) $(CFLAGS) -fPIC -c -o $@ $<
$(PYTHON)/%_wrap.o: $(PYTHON)/%_wrap.cxx
- @echo "-> compiling $@"
- $(CXX) $(CFLAGS) -I$(SRCDIR) $(PYLIB) -fPIC -c $< -o $@
+ @echo "-> compiling $@"
+ @$(CXX) $(PYLIB) $(CFLAGS) $(IGNOREFLAGS) -I$(SRCDIR) -fPIC -c $< -o $@
$(PYTHON)/%_wrap.cxx: $(PYTHON)/%.i
@echo "-> compiling $@"
- $(SWIG) -c++ -python $<
- python $(MAINDIR)/tools/finalize.py $(<:.i=.py) SatWrapper
+ @$(SWIG) -c++ -python $<
+ @python $(MAINDIR)/tools/finalize.py $(<:.i=.py) SatWrapper
$(PYTHON)/%.i: $(SRCDIR)/%.hpp
- python $(MAINDIR)/tools/mk_subinterface.py sat SatWrapper $<
+ @echo "-> creating interface $@"
+ @python $(MAINDIR)/tools/mk_subinterface.py sat SatWrapper $<
$(PYTHON)/_%.so: $(OBJDIR)/%.o $(PYTHON)/%_wrap.o $(WALKSRC)/cpp_walksat.o $(SATDIR)/obj/SatWrapper.o
@echo "-> linking $@"
- $(CXX) $(BUNDLE) -Wno-long-double $(CFLAGS) $(MAINOBJFILES) $(PYTHON)/Walksat_wrap.o $(WALKSRC)/cpp_walksat.o $(SATDIR)/obj/SatWrapper.o -o $@
+ @$(CXX) $(BUNDLE) -Wno-long-double $(CFLAGS) $(MAINOBJFILES) $(PYTHON)/Walksat_wrap.o $(WALKSRC)/cpp_walksat.o $(SATDIR)/obj/SatWrapper.o -o $@
#---- EOF --------------------------------------------------------------------

0 comments on commit 7f8df55

Please sign in to comment.