Skip to content
Snippets Groups Projects
Makefile 1.06 KiB
Newer Older
Louise's avatar
Louise committed
#Makefile for Ether of Creatures C++ application
#Created by Louise Stella on 02/06/2017

INC_DIR = include
SRC_DIR = src
OBJ_DIR = build
LIB_DIR = lib


Louise's avatar
Louise committed
CC = g++
CFLAGS = -O0 -g -W -Wall -pedantic -std=c++11 -ansi -I. -I$(INC_DIR)
ARCHIVE = ar

linux: jokenpo.a jokenpo.so static_jokenpo dynamic_jokenpo

jokenpo.a: $(SRC_DIR)/jokenpo.cpp $(INC_DIR)/jokenpo.hpp
    $(CC) $(CFLAGS) -c $(SRC_DIR)/jokenpo.cpp -o $(OBJ_DIR)/jokenpo.o
    $(AR) rcs $(LIB_DIR)/$@ $(OBJ_DIR)/jokenpo.o
    @echo "+++ [Static library created at $(LIB_DIR)/$@] +++"
Louise's avatar
Louise committed

jokenpo.so: $(SRC_DIR)/jokenpo.cpp $(INC_DIR)/jokenpo.hpp
    $(CC) $(CFLAGS) -fPIC -c $(SRC_DIR)/jokenpo.cpp -o $(OBJ_DIR)/jokenpo.o
    $(CC) -shared -fPIC -o $(LIB_DIR)/$@ $(OBJ_DIR)/jokenpo.o
    @echo "+++ [Dynamic library created at $(LIB_DIR)/$@] +++"
Louise's avatar
Louise committed

static_jokenpo:
    $(CC) $(CFLAGS) $(SRC_DIR)/main.cpp $(LIB_DIR)/jokenpo.a -o $(OBJ_DIR) /$@
Louise's avatar
Louise committed

dynamic_jokenpo:
    $(CC) $(CFLAGS) $(SRC_DIR)/main.cpp $(LIB_DIR)/jokenpo.so -o $(OBJ_DIR) /$@
Louise's avatar
Louise committed

clean:
    @echo "Removing object files and executable/binaries..." 
	@rm -rf $(OBJ_DIR)