X-Git-Url: https://git.bzium.org/embe/choinka.git/blobdiff_plain/e6c419ea3d0fa00bd36f4a1a5c08dae6479489bf..abbd11b06b1428651fb054661ec2475632701037:/Makefile diff --git a/Makefile b/Makefile index 1c2a472..c9f6b9b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,40 @@ -CFLAGS := -W -Wall -std=gnu99 -LDLIBS := -lncurses +CC := gcc +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)