Skip to content

Instantly share code, notes, and snippets.

@tibaes
Created May 21, 2015 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibaes/34e12eb4defeaac53c0f to your computer and use it in GitHub Desktop.
Save tibaes/34e12eb4defeaac53c0f to your computer and use it in GitHub Desktop.
STASM library
# Makefile: osx makefile for stasm
EXE=.bin
# Note: high_gui is needed for the apps but not for the Stasm library per se.
LIBRARIES=`pkg-config --libs opencv`
# -Wno-long-long disables the "long long warnings" for the OpenCV headers
# -Wno-unused-parameter allows virtual func defs that don't use all params
# -Wno-unknown-pragmas allows OpenMP pragmas without complaint
CFLAGS=-std=c++11 -O2 -Wall -Wextra -pedantic\
-Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas -Wstrict-aliasing
INCLUDES=`pkg-config --cflags opencv` -Istasm
CXX=g++
vpath %.cpp stasm stasm/MOD_1
SRC=\
facedet.cpp\
initasm.cpp\
asm.cpp\
classicdesc.cpp\
convshape.cpp\
err.cpp\
eyedet.cpp\
eyedist.cpp\
faceroi.cpp\
hat.cpp\
hatdesc.cpp\
landmarks.cpp\
misc.cpp\
pinstart.cpp\
print.cpp\
shape17.cpp\
shapehacks.cpp\
shapemod.cpp\
startshape.cpp\
stasm.cpp\
stasm_lib.cpp
OBJFILES=$(patsubst %.cpp,obj/%.o,$(SRC))
OBJFILES_MINIMAL=\
$(OBJFILES) $(patsubst %.cpp,obj/%.o,minimal.cpp)
DEPENDENCY_FILES=\
$(patsubst %.o,%.d,\
$(OBJFILES_MINIMAL))
all:\
obj\
minimal$(EXE)
# Create the directory "obj" if necessary (obj is the directory for .o and .d files)
obj:
@mkdir -p obj
minimal$(EXE): $(OBJFILES_MINIMAL)
$(CXX) -o $@ $(CFLAGS) $(LIBRARIES) $(OBJFILES_MINIMAL)
# Invoke g++ to create dependency files *.d in the obj directory.
# Then invoke g++ to create object files *.o in the obj directory.
obj/%.o: %.cpp
$(CXX) -MF obj/$(notdir $(patsubst %.cpp,./%.d,$<)) $< -MM -MT $@ $(CFLAGS) $(INCLUDES)
$(CXX) -o $@ -c $< $(CFLAGS) $(DEFINES) $(INCLUDES)
# incorporate the dependency files obj/*.d created above
-include $(DEPENDENCY_FILES)
clean:
-rm -rf obj
-rm -f *.bin
-rm -f minimal.bmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment