-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (47 loc) · 1.55 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
#
# CoreMod by CyrIng
#
# Copyright (C) 2012-2015 CYRIL INGENIERIE
#
# Licenses: GPL2
#
# Makefile
#
CC = gcc
CFLAGS = -Wall -Wno-unused-but-set-variable -O0 -mtune=generic -x c
APP_NAME=coremod
SRC_PATH=.
OBJ_PATH=./obj
BIN_PATH=./bin
INC_PATH=.
#
all : $(APP_NAME)
@echo 'Ready : '$(BIN_PATH)/$(APP_NAME)
@if [ `id -u` -ne 0 ]; then echo 'Remark : You must be root to run CoreMod'; fi
#
help :
@echo 'make [all] : Compile, link and store executable file in' $(BIN_PATH)/$(APP_NAME)
@echo 'make clean : Remove object and binary files.'
@echo 'make clean-all : Remove object and binary sub-directories.'
#
clean :
@echo 'Cleaning ...'
@if [ -e $(BIN_PATH)/$(APP_NAME) ]; then rm -v $(BIN_PATH)/$(APP_NAME); else echo 'Nothing to do in '$(BIN_PATH); fi
@if [ -e $(OBJ_PATH)/$(APP_NAME).o ]; then rm -v $(OBJ_PATH)/$(APP_NAME).o; else echo 'Nothing to do in '$(OBJ_PATH); fi
#
clean-all:
@echo 'Cleaning all ...'
@if [ -d $(BIN_PATH) ]; then rm -vr $(BIN_PATH); else echo 'Nothing to do in '$(BIN_PATH); fi
@if [ -d $(OBJ_PATH) ]; then rm -vr $(OBJ_PATH); else echo 'Nothing to do in '$(OBJ_PATH); fi
#
$(APP_NAME) : $(APP_NAME).o
@echo -n 'Linking : '
@if [ ! -d $(BIN_PATH) ]; then mkdir $(BIN_PATH); fi
@$(CC) $(OBJ_PATH)/$(APP_NAME).o -o $(BIN_PATH)/$(APP_NAME)
@echo 'Done.'
#
$(APP_NAME).o : $(APP_NAME).c
@echo -n 'Compiling : '
@if [ ! -d $(OBJ_PATH) ]; then mkdir $(OBJ_PATH); fi
@$(CC) $(CFLAGS) -c $(APP_NAME).c -I $(INC_PATH) -o $(OBJ_PATH)/$(APP_NAME).o
@echo 'Done.'