forked from Tiiffi/mcrcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.2 KB
/
Makefile
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
# if you want to cross compile:
# export PATH=$PATH:/path/to/compiler/bin
# export CROSS_COMPILE=arm-none-linux-gnueabi-
# make
#
# Windows cross compile:
# i686-w64-mingw32-gcc -std=gnu99 -Wall -Wextra -Wpedantic -Os -s -o mcrcon.exe mcrcon.c -lws2_32
EXENAME = mcrcon
PREFIX ?= /usr/local
INSTALL = install
LINKER =
RM = rm -v -f
CC = gcc
CFLAGS = -std=gnu99 -Wall -Wextra -Wpedantic -Os -s
EXTRAFLAGS ?= -fstack-protector-strong
ifeq ($(OS), Windows_NT)
LINKER = -lws2_32
EXENAME = mcrcon.exe
RM = cmd /C del /F
endif
ifeq ($(shell uname), Darwin)
INSTALL = ginstall
CFLAGS = -std=gnu99 -Wall -Wextra -Wpedantic -Os
endif
.PHONY: all
all: $(EXENAME)
$(EXENAME): mcrcon.c
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(EXTRAFLAGS) -o $@ $< $(LINKER)
ifneq ($(OS), Windows_NT)
.PHONY: install
install:
$(INSTALL) -vD $(EXENAME) $(DESTDIR)$(PREFIX)/bin/$(EXENAME)
$(INSTALL) -vD -m 0644 mcrcon.1 $(DESTDIR)$(PREFIX)/share/man/man1/mcrcon.1
@echo "\nmcrcon installed. Run 'make uninstall' if you want to uninstall.\n"
.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/$(EXENAME) $(DESTDIR)$(PREFIX)/share/man/man1/mcrcon.1
@echo "\nmcrcon uninstalled.\n"
endif
.PHONY: clean
clean:
$(RM) $(EXENAME)