Commit 828f87de authored by Célestin Marot's avatar Célestin Marot
Browse files

change structure

parent 0c0939e0
CFLAGS=-Wall -Wextra -O3 #add '-fPIC' for shared library
LDFLAGS=-lm #add '-shared' for shared library
TARGET=./test #replace by 'libHXTSPR.so' for shared library
# compilation and linking flags
CFLAGS=-Wall -Wextra -O3
LDFLAGS=-lm
SRC=$(wildcard *.c) #replace by '$(filter-out src/test.c,$(wildcard *.c))' for shared library
OBJ=$(SRC:.c=.o)
# directories
SRCDIR=src
OBJDIR=.cache
BINDIR=bin
$(TARGET): $(OBJ)
# targets
EXE=$(BINDIR)/test
SRC=$(wildcard $(SRCDIR)/*.c)
OBJ=$(SRC:$(SRCDIR)/%.c=$(CACHEDIR)/%.o)
$(EXE): $(OBJ) | $(BINDIR)
$(CC) -o $@ $^ $(LDFLAGS)
predicates.o: predicates.c predicates.h
HXTSPR.o: HXTSPR.c HXTSPR.h predicates.h
test.o: test.c HXTSPR.h predicates.h
$(SRCDIR)/predicates.o: $(SRCDIR)/predicates.c $(SRCDIR)/predicates.h
$(SRCDIR)/HXTSPR.o: $(SRCDIR)/HXTSPR.c $(SRCDIR)/HXTSPR.h $(SRCDIR)/predicates.h
$(SRCDIR)/test.o: $(SRCDIR)/test.c $(SRCDIR)/HXTSPR.h
$(OBJ):
$(OBJ): | $(OBJDIR)
# @echo $@ depends on $^
$(CC) $(CFLAGS) -o $@ -c $< $(LDFLAGS)
$(BINDIR):
mkdir $@
$(OBJDIR):
mkdir $@
help:
less README.md
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment