LO27/Makefile

54 lines
1.2 KiB
Makefile
Raw Normal View History

2016-12-10 01:28:10 +00:00
# Makefile compiling the whole project
# Don't forget before the first compilation to run that command:
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./Libs
2016-11-09 10:06:10 +00:00
2016-12-10 01:28:10 +00:00
CC=gcc
2016-12-27 00:43:49 +00:00
CFLAGS=-Wall -Werror -pedantic -fpic -g -std=c89
2016-11-09 10:06:10 +00:00
2016-12-27 16:36:08 +00:00
EXTLIBS=`sdl2-config --cflags --libs`
2016-11-09 10:06:10 +00:00
2016-12-10 01:28:10 +00:00
LIBSDIR=-L/usr/lib -L./Libs
INCLUDEDIR=-I/usr/include -I. -I./LibAutomaton -I./LibGui
2016-11-09 10:06:10 +00:00
2016-12-10 01:28:10 +00:00
#Exe test variables
2016-12-27 16:36:08 +00:00
TARGET=main
2016-12-10 01:28:10 +00:00
SOURCE=main
2016-11-09 10:06:10 +00:00
2016-12-10 01:28:10 +00:00
SOURCECFILE=$(SOURCE:=.c)
SOURCEOFILE=$(SOURCE:=.o)
DEPENDENCELIST=libAutomaton.so libGui.so
DEPENDENCENAMEONE=Automaton
DEPENDENCENAMETWO=Gui
2016-12-10 01:28:10 +00:00
all: $(TARGET)
#Generating the main.exe
$(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib
@echo "\n Generating the " $(TARGET) " binary"
2016-12-10 22:21:17 +00:00
mkdir -p build
$(CC) $(SOURCEOFILE) $(LIBSDIR) $(EXTLIBS) -l$(DEPENDENCENAMEONE) -l$(DEPENDENCENAMETWO) -o ./build/$(TARGET)
2016-12-10 01:28:10 +00:00
#Generating the library binary
2016-11-09 10:06:10 +00:00
lib:
2016-12-10 01:28:10 +00:00
@echo "\n Generating the automaton library binary"
$(MAKE) -C LibGui
2016-12-10 01:28:10 +00:00
$(DEPENDENCELIST):
2016-12-11 00:53:18 +00:00
@echo "\n Generating the automaton library binary"
mkdir -p Libs
$(MAKE) -C LibAutomaton
2016-12-10 01:28:10 +00:00
2016-11-09 10:06:10 +00:00
2016-12-10 01:28:10 +00:00
#Generating object files
.c.o:
@echo "\n Generating " $@ " from " $<
$(CC) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $<
#Cleaning
clean:
@echo "\n Cleaning"
rm -rf *.o ./Libs/*.so *.exe
2016-12-11 00:53:18 +00:00
$(MAKE) -C LibAutomaton clean