mbpfan/Makefile
2012-06-15 21:47:23 +02:00

66 lines
1.6 KiB
Makefile

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
ifeq ($(COMPILER), G++)
ifeq ($(OS),Windows_NT)
OBJ = obj
else
OBJ = o
endif
COPT =
CCMD = g++
OBJFLAG = -o
EXEFLAG = -o
# INCLUDES = -I../.includes
INCLUDES =
# LIBS = -lgc
LIBS = -lm
# LIBPATH = -L../gc/.libs
LIBPATH =
CPPFLAGS = $(COPT) -g $(INCLUDES)
LDFLAGS = $(LIBPATH) -g $(LIBS)
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)
@echo Compiling $(basename $<)...
$(CCMD) -c $(CPPFLAGS) $(CXXFLAGS) $< $(OBJFLAG)$@
all: $(OBJS)
@echo Linking...
$(CCMD) $(LDFLAGS) $^ $(LIBS) $(EXEFLAG) $(EXE)
clean:
rm -rf $(SOURCE_PATH)*.$(OBJ) $(EXE)
install:
cp $(EXE) /usr/sbin
@echo "-----------------------------------------------------------------------------"
@echo "An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu fur sure)"
@echo "Is located in the main folder of the source files. It is called mbpfan.init."
@echo "Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)"
@echo "and move it to /etc/init.d"
@echo "Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults"
@echo "-----------------------------------------------------------------------------"
rebuild: clean all
#rebuild is not entirely correct