mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-22 22:13:19 +00:00
Deleted files + fixed makefile
This commit is contained in:
parent
9d57b532f6
commit
99cf913820
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
Libs/
|
27
LibCell/Makefile
Normal file
27
LibCell/Makefile
Normal file
@ -0,0 +1,27 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Werror -pedantic -fpic -g
|
||||
|
||||
|
||||
LIBSDIR=-L/usr/lib -L../Libs
|
||||
INCLUDEDIR=-I/usr/include -I.
|
||||
|
||||
#Library variables
|
||||
LIBTARGET=libCellElement.so
|
||||
LIBSOURCE=CellElement
|
||||
LIBSOURCECFILE=$(LIBSOURCE:=.c)
|
||||
LIBSOURCEOFILE=$(LIBSOURCE:=.o)
|
||||
|
||||
#Generating the library binary
|
||||
$(LIBTARGET): $(LIBSOURCEOFILE)
|
||||
@echo "\n Generating the library binary"
|
||||
$(CC) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET)
|
||||
|
||||
#Generating object files
|
||||
.c.o:
|
||||
@echo "\n Generating " $@ " from " $<
|
||||
$(CC) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $<
|
||||
|
||||
#Cleaning
|
||||
clean:
|
||||
@echo "\n Cleaning"
|
||||
rm -rf *.o *.exe *.so
|
@ -2,14 +2,14 @@
|
||||
* @Author: klmp200
|
||||
* @Date: 2016-12-10 01:32:50
|
||||
* @Last Modified by: klmp200
|
||||
* @Last Modified time: 2016-12-10 01:33:40
|
||||
* @Last Modified time: 2016-12-10 04:29:48
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <CellElment.h>
|
||||
#include <CellElement.h>
|
||||
|
||||
void freeCellElement(cellElement* element) {
|
||||
void FreeCellElement(cellElement* element) {
|
||||
if (element != NULL){
|
||||
free(element);
|
||||
}
|
@ -8,8 +8,8 @@
|
||||
*/
|
||||
typedef enum Bool{
|
||||
|
||||
true = 1;
|
||||
false = 0;
|
||||
true = 1,
|
||||
false = 0
|
||||
|
||||
} bool;
|
||||
|
||||
@ -40,6 +40,6 @@ struct cellElement {
|
||||
typedef struct cellElement * cellElement;
|
||||
|
||||
|
||||
void freeCellElement(cellElement* element);
|
||||
void FreeCellElement(cellElement* element);
|
||||
|
||||
#endif
|
30
LibList/Makefile
Normal file
30
LibList/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Werror -pedantic -fpic -g
|
||||
|
||||
|
||||
LIBSDIR=-L/usr/lib -L../Libs
|
||||
INCLUDEDIR=-I/usr/include -I.
|
||||
|
||||
#Library variables
|
||||
LIBTARGET=libList.so
|
||||
LIBSOURCE=list CellElement
|
||||
LIBSOURCECFILE=$(LIBSOURCE:=.c)
|
||||
LIBSOURCEOFILE=$(LIBSOURCE:=.o)
|
||||
|
||||
#Generating the library binary
|
||||
$(LIBTARGET): $(LIBSOURCEOFILE)
|
||||
@echo "\n Generating the library binary"
|
||||
mkdir -p ../Libs
|
||||
$(CC) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET)
|
||||
|
||||
#Generating object files
|
||||
.c.o:
|
||||
@echo "\n Generating " $@ " from " $<
|
||||
$(CC) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $<
|
||||
|
||||
#Cleaning
|
||||
clean:
|
||||
@echo "\n Cleaning"
|
||||
rm -rf *.o *.exe *.so
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <CellElment.h>
|
||||
#include <CellElement.h>
|
||||
#include <list.h>
|
||||
|
||||
#define SUCCESS 0
|
||||
@ -36,7 +36,7 @@ int unshift(List *list, cellElement *data){
|
||||
|
||||
ListElement *newElement = malloc(sizeof(*newElement));
|
||||
if (list != NULL && newElement != NULL && newData != NULL){
|
||||
memcpy(newData, data, size);
|
||||
memcpy(newData, data, sizeof(cellElement));
|
||||
newElement->data = newData;
|
||||
|
||||
/* Insert the element at the begining of the list */
|
||||
@ -71,7 +71,7 @@ int push(List *list, cellElement *data){
|
||||
|
||||
ListElement *newElement = malloc(sizeof(*newElement));
|
||||
if(list != NULL && newElement != NULL && newData != NULL){
|
||||
memcpy(newData, data, size);
|
||||
memcpy(newData, data, sizeof(cellElement));
|
||||
newElement->data = newData;
|
||||
newElement->next = NULL;
|
||||
if (list->tail == NULL){
|
||||
@ -145,7 +145,7 @@ int PopPtnList(List *list, ListElement *element){
|
||||
}
|
||||
|
||||
if (element->data != NULL){
|
||||
freeCellElement(element->data);
|
||||
FreeCellElement(element->data);
|
||||
}
|
||||
free(element);
|
||||
list->size = list->size - 1;
|
||||
@ -187,10 +187,10 @@ int DeleteListContent(List *list){
|
||||
current = current->next;
|
||||
|
||||
if (toDelete->data != NULL){
|
||||
freeCellElement(toDelete->data);
|
||||
FreeCellElement(toDelete->data);
|
||||
}
|
||||
|
||||
freeCellElement(toDelete);
|
||||
free(toDelete);
|
||||
}
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LIST_H
|
||||
#define LIST_H
|
||||
|
||||
#import <CellElement.h>
|
||||
#include <CellElement.h>
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE 1
|
||||
@ -41,7 +41,7 @@ int unshift(List* list, cellElement* data);
|
||||
* @param size size of the data
|
||||
* @return status of the operation
|
||||
*/
|
||||
int push(List* list, cellElement* data, int size);
|
||||
int push(List* list, cellElement* data);
|
||||
|
||||
/*
|
||||
* Get an element in a given list
|
||||
|
5
Makefile
5
Makefile
@ -3,7 +3,7 @@
|
||||
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./Libs
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Werror -ansi -pedantic -fpic -g
|
||||
CFLAGS=-Wall -Werror -pedantic -fpic -g
|
||||
|
||||
|
||||
LIBSDIR=-L/usr/lib -L./Libs
|
||||
@ -34,6 +34,7 @@ $(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib
|
||||
#Generating the library binary
|
||||
lib:
|
||||
@echo "\n Generating the automaton library binary"
|
||||
mkdir -p Libs
|
||||
$(MAKE) -C LibCell
|
||||
|
||||
$(DEPENDENCELIST):
|
||||
@ -51,6 +52,6 @@ $(DEPENDENCELIST):
|
||||
clean:
|
||||
@echo "\n Cleaning"
|
||||
rm -rf *.o ./Libs/*.so *.exe
|
||||
$(MAKE) -C LibPoly clean
|
||||
$(MAKE) -C LibCell clean
|
||||
$(MAKE) -C LibList clean
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user