MODS := io PREFIX := /usr/local INSTALL := install RM := rm -f CPPFLAGS := -I. CFLAGS := -std=c99 -Wall LDFLAGS := -lrt -lm -g CFLAGS += $(shell echo $(MODS:%=-DHAVE_MOD_%) | tr 'a-z' 'A-Z') OBJS := rosella.o gc.o builtin.o interp.o reader.o $(MODS:%=mods/mod_%.o) DEPS := $(OBJS:%.o=.%.d) GCNO := $(OBJS:%.o=%.gcno) GCDA := $(OBJS:%.o=%.gcda) ifeq ($(DEBUG),yes) CFLAGS += -g PROFILE := no dummy := $(shell $(RM) rosella $(OBJS) $(GCDA) $(GCNO)) else CFLAGS += -g -march=native -O2 -fomit-frame-pointer -mssse3 -mfpmath=sse CFLAGS += -DNDEBUG endif ifeq ($(PROFILE),yes) CFLAGS += -fprofile-generate LDFLAGS += -fprofile-generate endif ifneq (,$(wildcard *.gcda mods/*.gcda)) CFLAGS += -fprofile-use dummy := $(shell $(RM) rosella $(OBJS)) endif CPPFLAGS += $(EXTRA_CPPFLAGS) CFLAGS += $(EXTRA_CFLAGS) LDFLAGS += $(EXTRA_LDFLAGS) all: rosella depend: $(DEPS) .PHONY: all clean distclean realclean depend install uninstall clean: -$(RM) rosella $(OBJS) $(DEPS) $(GCDA) $(GCNO) distclean: clean realclean: distclean install: rosella $(INSTALL) -t $(PREFIX)/bin rosella uninstall: $(RM) $(PREFIX)/bin/rosella .%.d: %.c $(CC) $(CPPFLAGS) -MM $< -MF $@ -MT $(<:%.c=%.o) -MT $@ rosella: $(OBJS) -include $(DEPS)