mirror of
				https://gitlab.com/klmp200/LO27.git
				synced 2025-10-30 23:33:03 +00:00 
			
		
		
		
	Add true makefile + lists
This commit is contained in:
		
							
								
								
									
										79
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										79
									
								
								Makefile
									
									
									
									
									
								
							| @@ -1,35 +1,56 @@ | ||||
| CXX = gcc | ||||
| TARGET = exe | ||||
| SOURCEFILE = main | ||||
| CFLAGS = -Wall -Werror -I. -ansi -pedantic -fpic -g | ||||
| LIST_LIBRARY = matrix/libMatrix | ||||
| # Makefile compiling the whole project | ||||
| # Don't forget before the first compilation to run that command: | ||||
| # export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./Libs | ||||
|  | ||||
| #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 | ||||
| CC=gcc | ||||
| CFLAGS=-Wall -Werror -ansi -pedantic -fpic -g | ||||
|  | ||||
|  | ||||
| #Cleaning the executable | ||||
| clean: | ||||
| 	@echo "Cleaning temporary files and libMatrix.so" | ||||
| 	rm -rf *.o *- *.so $(TARGET) | ||||
| 	rm -rf $(LIST_LIBRARY).so | ||||
| #Generating library | ||||
| LIBSDIR=-L/usr/lib -L./Libs | ||||
| INCLUDEDIR=-I/usr/include -I. -I./LibCell -I./LibList | ||||
|  | ||||
| #Exe test variables | ||||
| TARGET=main.exe | ||||
| SOURCE=main | ||||
|  | ||||
| SOURCECFILE=$(SOURCE:=.c) | ||||
| SOURCEOFILE=$(SOURCE:=.o) | ||||
|  | ||||
| #Library variables | ||||
| DEPENDENCE=libCellElement.so | ||||
| DEPENDENCENAME=CellElement | ||||
|  | ||||
| DEPENDENCELIST=libList.so | ||||
| DEPENDENCENAMELIST=List | ||||
|  | ||||
|  | ||||
| all: $(TARGET) | ||||
|  | ||||
| #Generating the main.exe | ||||
| $(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib | ||||
| 	@echo "\n Generating the " $(TARGET) " binary" | ||||
| 	$(CC) $(SOURCEOFILE) $(LIBSDIR) -l$(DEPENDENCENAME) -l$(DEPENDENCENAMELIST) -o $(TARGET) | ||||
|  | ||||
| #Generating the library binary | ||||
| lib: | ||||
| 	@echo "Generating libMatrix.so" | ||||
| 	$(CXX) -Wall -Werror -ansi -pedantic -I. matrix.c -o $(LIST_LIBRARY).so -shared -fpic | ||||
| 	@echo "\n Generating the automaton library binary" | ||||
| 	$(MAKE) -C LibCell | ||||
|  | ||||
| release: | ||||
| 	@echo "Generating a release version of the program" | ||||
| 	make CFLAGS= '-Wall -Werror -I. -ansi -pedantic -fpic' | ||||
| $(DEPENDENCELIST): | ||||
| 	@echo "\n Generating the list library binary" | ||||
| 	$(MAKE) -C LibList | ||||
|  | ||||
|  | ||||
| #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 | ||||
| 	$(MAKE) -C LibPoly clean | ||||
| 	$(MAKE) -C LibList clean | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user