2012-06-09 14:25:28 +00:00
|
|
|
COMPILER=G++
|
|
|
|
|
|
|
|
# todo: object files into output path, processing c / c++ files in the same time (?), nested directories for source files (?)
|
|
|
|
C = c
|
|
|
|
OUTPUT_PATH = bin/
|
|
|
|
SOURCE_PATH = src/
|
|
|
|
EXE = bin/mbpfan
|
2012-07-04 23:22:48 +00:00
|
|
|
CONF = mbpfan.conf
|
2016-07-04 02:12:15 +00:00
|
|
|
DOC = README.md
|
|
|
|
MAN = mbpfan.8.gz
|
2012-06-09 14:25:28 +00:00
|
|
|
|
|
|
|
ifeq ($(COMPILER), G++)
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
OBJ = obj
|
|
|
|
else
|
|
|
|
OBJ = o
|
|
|
|
endif
|
2012-06-09 17:07:25 +00:00
|
|
|
COPT =
|
2012-06-09 14:25:28 +00:00
|
|
|
CCMD = g++
|
|
|
|
OBJFLAG = -o
|
|
|
|
EXEFLAG = -o
|
|
|
|
# INCLUDES = -I../.includes
|
|
|
|
INCLUDES =
|
|
|
|
# LIBS = -lgc
|
|
|
|
LIBS = -lm
|
|
|
|
# LIBPATH = -L../gc/.libs
|
|
|
|
LIBPATH =
|
2016-08-31 07:26:22 +00:00
|
|
|
CPPFLAGS += $(COPT) -g $(INCLUDES) #-Wall
|
|
|
|
LDFLAGS += $(LIBPATH) -g $(LIBS) #-Wall
|
2012-06-09 14:25:28 +00:00
|
|
|
DEP = dep
|
|
|
|
else
|
|
|
|
OBJ = obj
|
|
|
|
COPT = /O2
|
|
|
|
CCMD = cl
|
|
|
|
OBJFLAG = /Fo
|
|
|
|
EXEFLAG = /Fe
|
|
|
|
# INCLUDES = /I..\\.includes
|
|
|
|
INCLUDES =
|
|
|
|
# LIBS = ..\\.libs\\libgc.lib
|
|
|
|
LIBS =
|
|
|
|
CPPFLAGS = $(COPT) /DEBUG $(INCLUDES)
|
|
|
|
LDFLAGS = /DEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJS := $(patsubst %.$(C),%.$(OBJ),$(wildcard $(SOURCE_PATH)*.$(C)))
|
|
|
|
|
|
|
|
%.$(OBJ):%.$(C)
|
2012-07-03 11:30:43 +00:00
|
|
|
mkdir -p bin
|
2012-06-09 14:25:28 +00:00
|
|
|
@echo Compiling $(basename $<)...
|
|
|
|
$(CCMD) -c $(CPPFLAGS) $(CXXFLAGS) $< $(OBJFLAG)$@
|
|
|
|
|
|
|
|
all: $(OBJS)
|
|
|
|
@echo Linking...
|
|
|
|
$(CCMD) $(LDFLAGS) $^ $(LIBS) $(EXEFLAG) $(EXE)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(SOURCE_PATH)*.$(OBJ) $(EXE)
|
|
|
|
|
2012-08-22 13:05:52 +00:00
|
|
|
tests:
|
|
|
|
make install
|
2014-07-07 06:59:06 +00:00
|
|
|
/usr/sbin/mbpfan -f -v -t
|
2012-08-22 13:05:52 +00:00
|
|
|
|
2012-08-22 13:53:07 +00:00
|
|
|
uninstall:
|
|
|
|
rm /usr/sbin/mbpfan
|
|
|
|
rm /etc/mbpfan.conf
|
2016-07-04 02:12:15 +00:00
|
|
|
rm /lib/systemd/system/mbpfan.service
|
|
|
|
rm /usr/share/man/man8/mbpfan.8.gz
|
|
|
|
rm -rf /usr/share/doc/mbpfan
|
2012-08-22 13:53:07 +00:00
|
|
|
|
2012-06-15 19:12:51 +00:00
|
|
|
install:
|
2012-08-22 13:05:52 +00:00
|
|
|
make
|
2016-07-04 02:12:15 +00:00
|
|
|
install -d $(DESTDIR)/usr/sbin
|
|
|
|
install -d $(DESTDIR)/etc
|
|
|
|
install -d $(DESTDIR)/lib/systemd/system
|
|
|
|
install -d $(DESTDIR)/usr/share/doc/mbpfan
|
|
|
|
install $(EXE) $(DESTDIR)/usr/sbin
|
|
|
|
install -m644 $(CONF) $(DESTDIR)/etc
|
|
|
|
install -m644 $(DOC) $(DESTDIR)/usr/share/doc/mbpfan
|
|
|
|
install -d $(DESTDIR)/usr/share/man/man8
|
|
|
|
install -m644 $(MAN) $(DESTDIR)/usr/share/man/man8
|
2012-08-19 12:33:35 +00:00
|
|
|
@echo ""
|
2012-08-22 13:05:52 +00:00
|
|
|
@echo "******************"
|
|
|
|
@echo "INSTALL COMPLETED"
|
|
|
|
@echo "******************"
|
|
|
|
@echo ""
|
2016-08-31 07:26:22 +00:00
|
|
|
@echo "A configuration file has been copied (might overwrite existing file) to /etc/mbpfan.conf."
|
2012-08-22 13:05:52 +00:00
|
|
|
@echo "See README.md file to have mbpfan automatically started at system boot."
|
|
|
|
@echo ""
|
|
|
|
@echo "Please run the tests now with the command"
|
|
|
|
@echo " sudo make tests"
|
2012-08-19 12:33:35 +00:00
|
|
|
@echo ""
|
2012-06-09 14:25:28 +00:00
|
|
|
rebuild: clean all
|
2014-07-07 06:59:06 +00:00
|
|
|
#rebuild is not entirely correct
|