# Copyright 2015 Jose-Luis Lisani # # Copying and distribution of this file, with or without # modification, are permitted in any medium without royalty provided # the copyright notice and this notice are preserved. This file is # offered as-is, without any warranty. # C source code CSRC = library/libImageFormats.c # C++ source code CXXSRC = library/libImage.cpp \ library/libBasic.cpp \ library/libCartoon.cpp \ library/libImageFormatPM.cpp # all source code SRC = $(CSRC) $(CXXSRC) # C objects COBJ = $(CSRC:.c=.o) # C++ objects CXXOBJ = $(CXXSRC:.cpp=.o) # all objects OBJ = $(COBJ) $(CXXOBJ) # binary target BIN = src_cartoon_plus_texture_newdirectional default : $(BIN) # use DEBUG mode with `make DEBUG=1` ifdef DEBUG # C optimization flags COPT = -g else # C optimization flags COPT = -O3 -ftree-vectorize -funroll-loops endif # C++ optimization flags CXXOPT = $(COPT) # C compilation flags CFLAGS = $(COPT) -std=c99 # C++ compilation flags CXXFLAGS = $(CXXOPT) -ansi # link flags LDFLAGS = -lm -lpng -ltiff -ljpeg -lfftw3 -lfftw3f # use openMP with `make OMP=1` ifdef OMP CFLAGS += -fopenmp CXXFLAGS += -fopenmp LDFLAGS += -lgomp else CFLAGS += -Wno-unknown-pragmas CXXFLAGS += -Wno-unknown-pragmas endif # partial compilation of C source code %.o: %.c %.h $(CC) -c -o $@ $< $(CFLAGS) # partial compilation of C++ source code %.o: %.cpp %.h $(CXX) -c -o $@ $< $(CXXFLAGS) # link all the object code $(BIN): % : %.o $(OBJ) $(CXX) -o $@ $^ $(LDFLAGS) # housekeeping .PHONY : clean distclean clean : $(RM) $(OBJ) distclean : clean $(RM) $(BIN) *.o *~