Skip to content
Snippets Groups Projects
Commit 6de27e41 authored by CAPACES Nicolas's avatar CAPACES Nicolas
Browse files

add files

parent fabedba5
No related branches found
No related tags found
No related merge requests found
Makefile 0 → 100644
CC := gcc
CFLAGS := -O3 -Wall -Wextra -Wpedantic
LFLAGS := -O3 -Wall -Wextra -Wpedantic -fPIC
LPATH := /usr/local/lib/
LSRCS := mars.c
LOBJS := $(LSRCS:.c=.o)
LTARGET := $(LPATH)libmars.so.1.0.1
LNAME := libmars.so.1
TARGET := out
SRCS := main.c
LIBS := -lmars
IPATH := /usr/local/include/
INCLUDE := mars.h
ITARGET := $(IPATH)$(INCLUDE)
.PHONY: clean all
$(LTARGET): $(LOBJS)
$(CC) $(CFLAGS) -shared -Wl,-soname,$(LNAME) -o $(LTARGET) $(LOBJS)
$(TARGET): $(SRCS)
$(CC) $(CFLAGS) -Wl,-rpath,$(LPATH) -o $(TARGET) $(SRCS) $(LIBS)
$(ITARGET): $(INCLUDE)
cp $(INCLUDE) $(ITARGET)
.c.o:
$(CC) $(LFLAGS) -c $< -o $@
all: $(TARGET) $(LTARGET) $(ITARGET)
@echo Successful compilation
clean:
$(RM) *.o
main.c 0 → 100644
#include <stdio.h>
#include <stdlib.h>
#include <mars.h>
int main(void){
printf("%s\n", "Hello earth!");
printf("%s\n", mars());
return EXIT_SUCCESS;
}
mars.c 0 → 100644
char* mars(void){
return "Hello Mars!";
}
mars.h 0 → 100644
#ifndef MARS_H_
#define MARS_H_
extern char* mars(void);
#endif /* mars.h */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment