mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-25 04:54:14 +00:00
51 lines
1.1 KiB
Makefile
51 lines
1.1 KiB
Makefile
# Makefile compiling the whole project
|
|
# Don't forget before the first compilation to run that command:
|
|
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./Libs
|
|
|
|
CC=gcc
|
|
CFLAGS=-Wall -Werror -pedantic -fpic -g -std=c89 -Wextra
|
|
|
|
EXTLIBS=`sdl2-config --cflags --libs`
|
|
|
|
LIBSDIR=-L/usr/lib -L./Libs
|
|
INCLUDEDIR=-I/usr/include -I. -I./LibMatrix -I./LibGui
|
|
|
|
#Exe test variables
|
|
TARGET=Matrix.exe
|
|
SOURCE=matrixmain
|
|
|
|
SOURCECFILE=$(SOURCE:=.c)
|
|
SOURCEOFILE=$(SOURCE:=.o)
|
|
|
|
DEPENDENCELIST=libMatrix.so libGui.so
|
|
DEPENDENCENAMEONE=Matrix
|
|
DEPENDENCENAMETWO=Gui
|
|
|
|
|
|
all: $(TARGET)
|
|
#Generating the main.exe
|
|
$(TARGET): $(SOURCEOFILE) lib
|
|
@echo "\n Generating the " $(TARGET) " binary"
|
|
mkdir -p build
|
|
$(CC) $(SOURCEOFILE) $(LIBSDIR) $(EXTLIBS) -l$(DEPENDENCENAMEONE) -l$(DEPENDENCENAMETWO) -o ./build/$(TARGET)
|
|
|
|
#Generating the library binary
|
|
lib:
|
|
@echo "\n Generating the gui library binary"
|
|
mkdir -p Libs
|
|
$(MAKE) -C LibMatrix
|
|
$(MAKE) -C LibGui
|
|
|
|
#Generating object files
|
|
.c.o:
|
|
@echo "\n Generating " $@ " from " $<
|
|
$(CC) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $<
|
|
|
|
|
|
#Cleaning
|
|
clean:
|
|
@echo "\n Cleaning"
|
|
rm -rf *.o ./Libs/*.so ./build/$(TARGET)
|
|
$(MAKE) -C LibMatrix clean
|
|
$(MAKE) -C LibGui clean
|