Added a first ver of the makefile

This commit is contained in:
Naej 2016-11-09 11:06:10 +01:00
parent b92fcc50a9
commit 721eb1f55d
1 changed files with 35 additions and 0 deletions

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
CXX = gcc
TARGET = exe
SOURCEFILE = main
CFLAGS = -Wall -Werror -I. -ansi -pedantic -fpic -g
LIST_LIBRARY = matrix/libMatrix
#Generating the executable
$(TARGET): $(SOURCEFILE).o
@echo "Generating the executable"
$(CXX) $(CFLAGS) $(SOURCEFILE).o -o $(TARGET)
$(SOURCEFILE).o: $(LIST_LIBRARY).so
@echo "Generating $(SOURCEFILE).o"
$(CXX) $(CFLAGS) -Lmatrix -lmatrix -c $(SOURCEFILE).c -o $@ -LlibMatrix -llibMatrix.so
$(LIST_LIBRARY).so:clean
@echo "Generating libMatrix.so" $@
#gcc matrix.c -I. -Wall -Werror -fpic -shared -o $(LIST_LIBRARY).so
$(CXX) -Wall -Werror -ansi -pedantic -I. matrix.c -o $(LIST_LIBRARY).so -shared -fpic
#Cleaning the executable
clean:
@echo "Cleaning temporary files and libMatrix.so"
rm -rf *.o *- *.so $(TARGET)
rm -rf $(LIST_LIBRARY).so
#Generating library
lib:
@echo "Generating libMatrix.so"
$(CXX) -Wall -Werror -ansi -pedantic -I. matrix.c -o $(LIST_LIBRARY).so -shared -fpic
release:
@echo "Generating a release version of the program"
make CFLAGS= '-Wall -Werror -I. -ansi -pedantic -fpic'