This repository was archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.28 KB
/
Makefile
File metadata and controls
53 lines (42 loc) · 1.28 KB
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
STD=c11
override CFLAGS+=-Werror -Wall -g -fPIC -O2 -DNDEBUG -ftrapv -Wfloat-equal -Wundef -Wwrite-strings -Wconversion -Wuninitialized -pedantic -std=$(STD)
PREFIX=/usr/bin/
BUILDDIR=bin/
DEBUGDIR=debug/
LIBS=-D_GNU_SOURCE
CC=cc
TARGET=decode
SOURCES=$(wildcard src/*.c)
#Makes everything
all:
mkdir -p $(BUILDDIR) 2> /dev/null
$(CC) $(CFLAGS) $(LIBS) $(SOURCES) -o $(BUILDDIR)$(TARGET)
#Uses picky extensions and makes everything(Extensions may break compiling)
dev:
make all CFLAGS+="-Wshadow -Wunreachable-code -Wswitch-enum -Wswitch-default -Wcast-align -Winit-self -Wpointer-arith"
#Run the preprocessor only
pp:
mkdir -p $(DEBUGDIR) 2> /dev/null
$(CC) -E $(LIBS) $(SOURCES) > $(DEBUGDIR)preprocessed.i
#Run the preprocessor and asm generator
asm:
mkdir -p $(DEBUGDIR) 2> /dev/null
$(CC) -S $(LIBS) $(SOURCES)
mv *.s $(DEBUGDIR)
#Create object code
obj:
mkdir -p $(DEBUGDIR) 2> /dev/null
$(CC) -c $(LIBS) $(SOURCES)
mv *.o $(DEBUGDIR)
#Make all diagnostics files
diagnostics: pp asm obj
#Cleans directory(no uninstall!)
clean:
rm -rf $(BUILDDIR) $(DEBUGDIR)
#Installs into specified(or default) directory
install:
install -d $(PREFIX)$(TARGET)
install $(BUILDDIR)$(TARGET) $(PREFIX)$(TARGET)
#Uninstalls from specified(or default)directory
uninstall:
rm -rf $(PREFIX)$(TARGET)