COMMONFLAGS = -Os -pipe -D_XOPEN_SOURCE=500 CFLAGS = -std=c99 CXXFLAGS = -std=c++11 LIBS = -lm -lrt SRCS_C = $(sort $(wildcard *.c)) SRCS_CC = $(sort $(wildcard *.cc)) OBJS = $(SRCS_C:.c=.o) $(SRCS_CC:.cc=.o) BINS = bench .PHONY: all clean all: $(BINS) clean: rm -f $(BINS) rm -f $(OBJS) bench: $(OBJS) $(CXX) $^ -o $@ $(LIBS) %.o: %.cc $(CXX) $(COMMONFLAGS) $(CXXFLAGS) -c $< -o $@ %.o: %.c $(CC) $(COMMONFLAGS) $(CFLAGS) -c $< -o $@