diff --git a/Makefile b/Makefile index 8a15e43..0cbc4ec 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ MODS := io +PREFIX := /usr/local + +INSTALL := install +RM := rm -f CPPFLAGS := -I. CFLAGS := -std=c99 -Wall @@ -14,7 +18,7 @@ GCDA := $(OBJS:%.o=%.gcda) ifeq ($(DEBUG),yes) CFLAGS += -g PROFILE := no - dummy := $(shell rm -f rosella $(OBJS) $(GCDA) $(GCNO)) + dummy := $(shell $(RM) rosella $(OBJS) $(GCDA) $(GCNO)) else CFLAGS += -O3 -DNDEBUG -march=nocona endif @@ -26,16 +30,25 @@ endif ifneq (,$(wildcard *.gcda mods/*.gcda)) CFLAGS += -fprofile-use - dummy := $(shell rm -f rosella $(OBJS)) + dummy := $(shell $(RM) rosella $(OBJS)) endif all: rosella depend: $(DEPS) -.PHONY: all clean depend +.PHONY: all clean distclean realclean depend install uninstall clean: - -rm -f rosella $(OBJS) $(DEPS) $(GCDA) $(GCNO) + -$(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 $@