VPATH = ../poppler:../glib:../goo:../fofi .RECIPEPREFIX += PKGCONFIG = C:\GTK\bin\pkg-config.exe #recipe above allows using spaces instead of the default tab in make files! #to debug a variable in make file use info to print: $(info _obj2 is $(_obj2)) #to make faster debug use make -n option to just print the commands instead of executing it (e.g. by compiling/linking) print-% : ; @echo $* = $($*) RM = del /f /q CC = gcc CC_RES=windres src = $(filter-out ../poppler/DCTStream.cc ../poppler/FlateStream.cc ../poppler/GlobalParamsWin.cc , $(wildcard ../poppler/*.cc)) \ $(wildcard ../glib/*.cc) $(wildcard ../goo/*.cc) $(wildcard ../fofi/*.cc) src2 = $(wildcard ../glib/*.c) objdir=$(DEV_BIN)/Release libfile=$(objdir)/libpoppler-glib.dll.a dllfile=$(objdir)/libpoppler-glib.dll _obj1 = $(patsubst %.cc,%.cc.o,$(src)) _obj2 = $(patsubst %.c,%.c.o,$(src2)) #_obj1 = $(filter %.o,$(csrc:.c=.o) $(src:.cc=.o)) obj = $(patsubst %.o,$(objdir)/%.o,$(notdir $(_obj1))) objc = $(patsubst %.o,$(objdir)/%.o,$(notdir $(_obj2))) libs = $(shell $(PKGCONFIG) --libs cairo) \ $(shell $(PKGCONFIG) --libs fontconfig) \ $(shell $(PKGCONFIG) --libs freetype2) \ $(shell $(PKGCONFIG) --libs glib-2.0) \ $(shell $(PKGCONFIG) --libs gobject-2.0) \ $(shell $(PKGCONFIG) --libs gdk-2.0) # -LC:\program_files\xournal-0.4.8.2016-win32\libpoppler-84.dll \ INCLUDES = -I../poppler -I../glib -I../goo -I../ \ -IC:/GTK/include \ $(shell $(PKGCONFIG) --cflags cairo) \ $(shell $(PKGCONFIG) --cflags fontconfig) \ $(shell $(PKGCONFIG) --cflags freetype2) \ $(shell $(PKGCONFIG) --cflags gdk-2.0) #-IC:/GTK/include/gtk-2.0 \ #-IC:\msys32\mingw32\include \ CXXFLAGS=-DNDEBUG \ -DWIN32 \ -D_WIN32_IE=1281 \ -O3 -g -s -flto -Wall -Wextra -mwindows -Wno-deprecated-declarations -Wno-unknown-pragmas \ -m32 -Wno-write-strings -Wno-unused-parameter #-m64 if 64-bit #link flags LDFLAGS = -lstdc++ -shared # rule to generate a dep file by using the C preprocessor # (see man cpp for details on the -MM and -MT options) # compiles .c to .o # $@ = $(output) # $< = $(input) $(objdir)/%.c.o: %.c @echo "Compiling..." $(CC) $(INCLUDES) $(CXXFLAGS) -c $< -o $@ $(objdir)/%.cc.o: %.cc @echo "Compiling..." $(CC) $(INCLUDES) $(CXXFLAGS) -c $< -o $@ poppler-glib: $(objc) $(obj) @echo "Linking..." $(CC) $(CXXFLAGS) $(objc) $(obj) $(libs) $(LDFLAGS) -o $(dllfile) -Wl,--out-implib=$(libfile) #.PHONY: clean .. todo.. I don't think this is working! clean: $(RM) $(subst /,\,$(obj)) $(subst /,\,$(dllfile))