-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (57 loc) · 1.33 KB
/
Makefile
File metadata and controls
66 lines (57 loc) · 1.33 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
54
55
56
57
58
59
60
61
62
63
64
65
ifeq ($(OS),Windows_NT)
WIN += 1
EXECUTEABLE += randomfile.exe
CC="C:\mingw64\bin\gcc.exe"
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
CCFLAGS += -D AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CCFLAGS += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CCFLAGS += -D IA32
endif
endif
else
EXECUTEABLE += randomfile
CC="gcc"
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CCFLAGS += -D LINUX
endif
ifeq ($(UNAME_S),Darwin)
CCFLAGS += -D OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CCFLAGS += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CCFLAGS += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CCFLAGS += -D ARM
endif
endif
FLAGS=-Wall -O2 -mtune=native -march=native
SRCS=string.o file.o output.o lists.o
all: $(EXECUTEABLE)
$(EXECUTEABLE): $(SRCS) main.c
$(CC) $(FLAGS) $(SRCS) -o $(EXECUTEABLE) main.c
spagetti: spagetti.c
$(CC) $(FLAGS) $(CCFLAGS) -o $(EXECUTEABLE) spagetti.c
run:
$(EXECUTEABLE) ./
clean:
ifeq ($(OS),Windows_NT)
del $(EXECUTEABLE)
del *.o
else
rm -f *.d *.o $(EXECUTEABLE)
endif
install: $(TARGET)
cp $(TARGET) /usr/bin/$(TARGET)
chmod go+rx /usr/bin/$(TARGET)
check:
./$(EXECUTEABLE)
echo "tests all pass!"