-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
64 lines (56 loc) · 1.69 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
53
54
55
56
57
58
59
60
61
62
63
64
#
# Makefile for macfan
#
# Origin: macfanctld Mikael Strom, August 2010
#
# macfand
# Aaron Blakely, June 2022
VERSION = 1.1.0b
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
CC = gcc
CFLAGS =-g3 -std=gnu99 -c -Iinclude -lconfig -lm
OBJ=./build
SRC=./src
EXEC=macfand
BINFLAGS=-g -lconfig -lm
ETC_DIR = /etc
MACHINES_DIR = $(PREFIX)/macfand/machines
all: macfand
macfand:
@rm -rf $(OBJ) && mkdir $(OBJ)
$(CC) $(CFLAGS) $(SRC)/config.c -o $(OBJ)/config.o
$(CC) $(CFLAGS) $(SRC)/control.c -o $(OBJ)/control.o
$(CC) $(CFLAGS) $(SRC)/macfan.c -o $(OBJ)/macfan.o
$(CC) $(CFLAGS) $(SRC)/util.c -o $(OBJ)/util.o
$(CC) $(CFLAGS) $(SRC)/logger.c -o $(OBJ)/logger.o
$(CC) $(CFLAGS) $(SRC)/applesmc.c -o $(OBJ)/applesmc.o
$(CC) -o $(EXEC) $(OBJ)/*.o $(BINFLAGS)
@echo "Build complete"
clean:
rm -rf build macfand
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp macfand $(DESTDIR)$(PREFIX)/bin/
chmod 755 $(DESTDIR)$(PREFIX)/bin/macfand
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp macfand.1 $(DESTDIR)$(MANPREFIX)/man1/macfand.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/macfand.1
cp macfand.conf $(ETC_DIR)
mkdir -p $(DESTDIR)$(MACHINES_DIR)
cp -a machines/* $(DESTDIR)$(MACHINES_DIR)
#cp macfand.service /usr/lib/systemd/system
sh macfand.service.gen > /usr/lib/systemd/system/macfand.service
perl ./util/updatemodel.pl
@echo " "
@echo "Done!"
@echo " "
@echo "Config file location: /etc/macfand.conf"
@echo "Profiles installed to: $(MACHINES_DIR)"
@echo " "
@echo "Be sure to enable macfand with systemd to run on startup. This can be done with:"
@echo " sudo systemctl enable --now macfand"
uninstall:
rm -f $(DESTDIR)$(PREFIX)/macfand
$(ETC_DIR)/macfan.conf
.PHONY: clean install uninstall