How to create the makefile for ImageMagick?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
haoxuan199307
Posts: 4
Joined: 2017-09-29T20:02:28-07:00
Authentication code: 1151

How to create the makefile for ImageMagick?

Post by haoxuan199307 » 2017-09-29T20:27:37-07:00

I installed ImageMagick using
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev libmagic-dev
sudo apt-get install imagemagick

But I do not know what I should add to the makefile of my project.

Makefile:

# Check for OS Type
UNAME_S := $(shell uname -s)

# Linux
ifeq ($(UNAME_S), Linux)
CC=g++
LIBS=-lSDL2 -lGLEW -lGL -lassimp
# Mac
else
CC=clang++
LIBS=-lSDL2 -framework OpenGL -framework Cocoa -lGLEW -stdlib=libc++
endif

# Paths, use this to set Include directories, or library directories; uncomment in all: if used
#PATHI=-I/usr/local/include/
#PATHL=-L/usr/local/lib/

#Compiler Flags
CXXFLAGS=-g -Wall -std=c++0x

# .o Compilation
O_FILES=main.o camera.o engine.o graphics.o object.o shader.o window.o

# Point to includes of local directories
INDLUDES=-I../include


all: $(O_FILES)
$(CC) $(CXXFLAGS) -o Tutorial $(O_FILES) $(LIBS) #$(PATHI) $(PATHL)

main.o: ../src/main.cpp
$(CC) $(CXXFLAGS) -c ../src/main.cpp -o main.o $(INDLUDES)

camera.o: ../src/camera.cpp
$(CC) $(CXXFLAGS) -c ../src/camera.cpp -o camera.o $(INDLUDES)

engine.o: ../src/engine.cpp
$(CC) $(CXXFLAGS) -c ../src/engine.cpp -o engine.o $(INDLUDES)

graphics.o: ../src/graphics.cpp
$(CC) $(CXXFLAGS) -c ../src/graphics.cpp -o graphics.o $(INDLUDES)

object.o: ../src/object.cpp
$(CC) $(CXXFLAGS) -c ../src/object.cpp -o object.o $(INDLUDES)

shader.o: ../src/shader.cpp
$(CC) $(CXXFLAGS) -c ../src/shader.cpp -o shader.o $(INDLUDES)

window.o: ../src/window.cpp
$(CC) $(CXXFLAGS) -c ../src/window.cpp -o window.o $(INDLUDES)

clean:
-@if rm *.o Tutorial 2>/dev/null || true; then echo "Main Removed"; else echo "No Main"; fi












Does anyone know what I should add to make file so that I can use #include <ImageMagick-6/Magick++.h> in my program?

Post Reply