X-Git-Url: https://git.bzium.org/embe/choinka.git/blobdiff_plain/6da32334286c176ac2dc4bd273b1f372a63533f7..399984620d6024e4f2f4943bef9a2229457eed50:/Makefile?ds=inline 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)