Add standard build targets (distclean, realclean, install, uninstall).

This commit is contained in:
Jesse D. McDonald 2009-11-24 00:00:19 -06:00
parent 06679a2790
commit 62e2095f31
1 changed files with 17 additions and 4 deletions

View File

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