summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..364c1fc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+
+SOURCE_DIR = src/
+INSTALL_DIR = /usr/local/
+
+BINARY = messenger-cli
+SOURCES = messenger_cli.c
+HEADERS =
+
+LIBRARIES = gnunetchat
+
+CC = gcc
+LD = gcc
+RM = rm
+
+CFLAGS = -pedantic -Wall -Wextra -march=native -ggdb3
+LDFLAGS =
+
+DEBUGFLAGS = -O0 -D _DEBUG
+RELEASEFLAGS = -O2 -D NDEBUG -fwhole-program
+
+SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES))
+OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
+HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
+LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
+
+all: $(BINARY)
+
+debug: CFLAGS += $(DEBUGFLAGS)
+debug: $(BINARY)
+
+release: CFLAGS += $(RELEASEFLAGS)
+release: $(BINARY)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@ $(LIBRARY_FLAGS)
+
+$(BINARY): $(OBJECT_FILES)
+ $(LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS)
+
+.PHONY: install
+
+install:
+ install -m 755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
+
+.PHONY: uninstall
+
+uninstall:
+ $(RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
+
+.PHONY: clean
+
+clean:
+ $(RM) -f $(BINARY)
+ $(RM) -f $(OBJECT_FILES) \ No newline at end of file