From 399984620d6024e4f2f4943bef9a2229457eed50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Bartoszkiewicz?= Date: Mon, 7 Dec 2009 23:50:30 +0100 Subject: [PATCH] =?utf8?q?Uporz=C4=85dkowanie=20Makefile,=20dodanie=20regu?= =?utf8?q?=C5=82ek=20=E2=80=9Eclean=E2=80=9D=20i=20=E2=80=9Einstall?= =?utf8?q?=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8207726..c9f6b9b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,40 @@ CC := gcc -CFLAGS := -O2 -Wextra -Wall -std=gnu99 -LDLIBS := -lncurses +CPPFLAGS := +CFLAGS := -O2 -Wextra -Wall +LDFLAGS := +LDLIBS := +RM := rm -all: choinka +override CFLAGS += -std=gnu99 +override LDLIBS += -lncurses + +INSTALL := install + +DESTDIR := +PREFIX := /usr +BINDIR = $(PREFIX)/bin + +EXE := choinka + +CSOURCES := $(wildcard *.c) +COBJECTS := $(CSOURCES:.c=.o) +SOURCES := $(sort $(CSOURCES)) +OBJECTS := $(sort $(COBJECTS)) + +.PHONY: all +all: $(EXE) + +%.o: %.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) $^ -o $@ + +$(EXE): $(OBJECTS) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +.PHONY: clean +clean: + $(RM) -f $(EXE) *.o *~ *.bak *.orig *.rej + +.PHONY: install +install: $(EXE) + $(INSTALL) -d $(DESTDIR)$(BINDIR) + $(INSTALL) -c $(EXE) $(DESTDIR)$(BINDIR) -- 2.45.2