M2_SETI/T2/tp/Makefile
2022-10-19 09:02:34 +02:00

44 lines
No EOL
1.3 KiB
Makefile
Executable file

.POSIX:
CC = cc
CFLAGS = -std=c11 -Wall -Wextra -O3 -mcx16 -pthread #-DDEBUG
LDFLAGS = -pthread
#LDLIBS = -latomic
C= $(wildcard *.c)
H= $(wildcard *.h)
PREAMBULE_SRCS := preambule.c
POSIX_SRCS := $(filter-out %preambule.c %Atomic.c %TestAndSet.c, $(C))
ATOMIC_SRCS := $(filter-out %preambule.c %POSIX.c %TestAndSet.c, $(C))
TESTANDSET_SRCS := $(filter-out %preambule.c %POSIX.c %Atomic.c, $(C))
DEPS= $(H:.h)
PREAMBULE_OBJS= $(PREAMBULE_SRCS:.c=.o)
POSIX_OBJS= $(POSIX_SRCS:.c=.o)
ATOMIC_OBJS= $(ATOMIC_SRCS:.c=.o)
TESTANDSET_OBJS= $(TESTANDSET_SRCS:.c=.o)
preambule: $(PREAMBULE_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o preambule $(PREAMBULE_OBJS) $(LDLIBS)
posix: $(POSIX_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwarePosix $(POSIX_OBJS) $(LDLIBS)
atomic: $(ATOMIC_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwareAtomic $(ATOMIC_OBJS) $(LDLIBS)
testandset: $(TESTANDSET_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwareTestAndSet $(TESTANDSET_OBJS) $(LDLIBS)
clean:
rm -f preambule mySoftwarePosix mySoftwareAtomic mySoftwareTestAndSet $(PREAMBULE_OBJS) $(POSIX_OBJS) $(ATOMIC_OBJS) $(TESTANDSET_OBJS)
runpreambule: clean preambule
./preambule
runposix: clean posix
./mySoftwarePosix
runatomic: clean atomic
./mySoftwareAtomic
runtestandset: clean testandset
./mySoftwareTestAndSet