-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (39 loc) · 1.53 KB
/
Copy pathMakefile
File metadata and controls
54 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
CC = gcc
CFLAGS = -Wall -Wextra -Wpedantic -std=c17 -Iinclude -D_BSD_SOURCE -D_DEFAULT_SOURCE -D__FAVOR_BSD -D_GNU_SOURCE
LDFLAGS = -lpcap -lpthread
SRCDIR = src
OBJDIR = obj
BUILDDIR = bin
INCLUDEDIR = include
SOURCES = $(SRCDIR)/cli.c $(SRCDIR)/main.c $(SRCDIR)/packet.c $(SRCDIR)/stats.c $(SRCDIR)/stress.c $(SRCDIR)/util.c $(SRCDIR)/process.c $(SRCDIR)/dns.c $(SRCDIR)/traceroute.c $(SRCDIR)/ping.c $(SRCDIR)/scan.c $(SRCDIR)/netstat.c $(SRCDIR)/arp.c $(SRCDIR)/route.c $(SRCDIR)/firewall.c $(SRCDIR)/bandwidth.c $(SRCDIR)/monitor.c $(SRCDIR)/discovery.c $(SRCDIR)/security.c
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
TARGET = $(BUILDDIR)/ripnet
VERSION := $(shell cat VERSION)
.PHONY: all clean install uninstall test release
all: $(TARGET)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(TARGET): $(OBJECTS) | $(OBJDIR) $(BUILDDIR)
$(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(OBJDIR) $(BUILDDIR)
install: $(TARGET)
install -d $(BINDIR)
install -m 755 $(TARGET) $(BINDIR)/ripnet
uninstall:
rm -f $(BINDIR)/ripnet
test: $(TARGET)
@echo "Running tests..."
@./tests/run_tests.sh || echo "No tests configured"
release: clean
@echo "Creating release for version $(VERSION)"
@git tag -a v$(VERSION) -m "Release version $(VERSION)" || true
@git archive --prefix=ripnet-$(VERSION)/ -o ripnet-$(VERSION).tar.gz HEAD
@echo "Release ripnet-$(VERSION).tar.gz created"