59 lines
1.1 KiB
Makefile
59 lines
1.1 KiB
Makefile
MODS := io
|
|
PREFIX := /usr/local
|
|
|
|
INSTALL := install
|
|
RM := rm -f
|
|
|
|
CPPFLAGS := -I.
|
|
CFLAGS := -std=c99 -Wall
|
|
LDFLAGS := -lrt -lm
|
|
|
|
CFLAGS += $(MODS:%=-DHAVE_MOD_%)
|
|
|
|
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 += -O3 -DNDEBUG -march=nocona
|
|
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
|
|
|
|
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)
|