-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (36 loc) · 739 Bytes
/
Makefile
File metadata and controls
44 lines (36 loc) · 739 Bytes
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
# Makefile for Random Password Generator
CC = cc
CFLAGS = -c -O3 -march=native
STRIP = strip
SOURCES = src/rpg.c
OBJECTS = $(SOURCES:.c=.o)
EXECUTABLE = rpg
.PHONY: all
all: $(SOURCES) $(EXECUTABLE) done
$(EXECUTABLE): $(OBJECTS)
@echo Linking...
$(CC) $(OBJECTS) -o $@
$(STRIP) $(EXECUTABLE)
chmod 755 $(EXECUTABLE)
.c.o:
@echo Compiling...
$(CC) $(CFLAGS) $< -o $@
.PHONY: clean
clean:
@echo Cleaning...
find . -name "*.o" -type f -delete
find . -name "*.gch" -type f -delete
.PHONY: done
done:
@echo -n
.PHONY: install
install:
@echo Installing...
ifeq ($(shell id -u), 0)
mkdir -p /usr/bin/
cp $(EXECUTABLE) /usr/bin/
else
mkdir -p ~/bin/
cp $(EXECUTABLE) ~/bin/
endif
# end of Makefile