-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile-linux
39 lines (29 loc) · 1.3 KB
/
makefile-linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CC=g++
STD=c++11
CFLAGS=-W --std=$(STD) -Wno-write-strings -lm
BUILD_PATH=./build
TARGET_NAME=$(BUILD_PATH)/top-gear
SOURCE_PATH=./src
LIB_PATH=./include
OUTPUT_PATH=./output
SOURCE_EXT := cpp
SOURCES := $(shell find $(SOURCE_PATH) -path '*.$(SOURCE_EXT)')
OBJECTS := $(patsubst $(SOURCE_PATH)/%,$(BUILD_PATH)/%,$(SOURCES:.$(SOURCE_EXT)=.o))
ALLEGRO_PATH=./allegro
ALLEGRO_LIBS=-lallegro -lallegro_acodec -lallegro_audio -lallegro_color -lallegro_dialog -lallegro_image -lallegro_main -lallegro_memfile -lallegro_physfs -lallegro_primitives -lallegro_ttf -lallegro_font
ALLEGRO_CONFIG=$(ALLEGRO_LIBS)
all: $(TARGET_NAME)
$(BUILD_PATH)/%.o: $(SOURCE_PATH)/%.$(SOURCE_EXT) $(LIB_PATH)/%.hpp
$(CC) -c $(CFLAGS) $(ALLEGRO_CONFIG) -o $@ $<
$(TARGET_NAME): $(OBJECTS) main.cpp
$(CC) $(CFLAGS) $(ALLEGRO_CONFIG) -o $(TARGET_NAME) main.c $(OBJECTS)
setup:
cp $(ALLEGRO_PATH)/bin/* $(BUILD_PATH)/
pkg-config --cflags --libs allegro-5 allegro_acodec-5 allegro_audio-5 allegro_color-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_main-5 allegro_memfile-5 allegro_physfs-5 allegro_primitives-5 allegro_ttf-5 allegro_video-5
run:
$(TARGET_NAME)
clean:
rm -rf $(BUILD_PATH)/*
rm $(TARGET_NAME)
mem:
valgrind --leak-check=full --show-leak-kinds=all $(TARGET_NAME) > ./output/mem.log