+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)