# makefile for example using semaphores for dining philosophers # It has only been tested for Solaris # since, at the time this was written, Linux did not support POSIX semaphores. # # the program or programs we want to build EXCUTABLES=memshare nosem segments # EXECUTABLES=nosem semp semm semmp semmpo semmno CC=gcc CFLAGS=-Wall -ansi -pedantic # LDFLAGS=-lposix4 -lnsl # If you just type "make", it will default to "make all". default: $(EXECUTABLES) segments: segments.c Makefile $(CC) $(CFLAGS) -o segments segments.c $(LDFLAGS) memshare: memshare.c Makefile $(CC) $(CFLAGS) -o memshare memshare.c $(LDFLAGS) nosem: philos.c Makefile gcc $(CFLAGS) -DUSE_MMAP -o nosem philos.c $(LDFLAGS) semp: philos.c Makefile gcc $(CFLAGS) -DUSE_POSIX_SEMAPHORES -o $@ $< $(LDFLAGS) semm: philos.c Makefile gcc $(CFLAGS) -DUSE_MMAP -o $@ $< $(LDFLAGS) semmp: philos.c Makefile gcc $(CFLAGS) -DUSE_MMAP -DUSE_POSIX_SEMAPHORES -o $@ $< $(LDFLAGS) semmpo: philos.c Makefile gcc $(CFLAGS) -DUSE_MMAP -DUSE_POSIX_SEMAPHORES -DUSE_ORDERED_LOCKING -o $@ $< $(LDFLAGS) semmno: philos.c Makefile gcc $(CFLAGS) -DUSE_MMAP -DUSE_POSIX_SEMAPHORES -DUSE_ORDERED_LOCKING -DUSE_UNNAMED_SEMAPHORES -o $@ $< $(LDFLAGS) # rule to clean up the directory clean: rm -f *.o $(EXECUTABLES) #