-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (34 loc) · 698 Bytes
/
Copy pathMakefile
File metadata and controls
50 lines (34 loc) · 698 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
45
46
47
48
49
50
USE_ASM=yes
CFLAGS = -pedantic -Wall -O2
LDFLAGS =
AS = nasm
ASFLAGS = -f elf64
OBJ = main.o map.o
SPEED_OBJ = speed.o
ifeq ($(USE_ASM), yes)
LDFLAGS += -no-pie
OBJ += crc64.o
SPEED_OBJ += crc64.o
else
OBJ += lookup.o crc64-lookup.o
SPEED_OBJ += lookup.o crc64-lookup.o
endif
.SUFFIXES: .asm
.PHONY: all clean cleanall
%.o: %.asm
$(AS) $(ASFLAGS) $< -o $@
all: crc64
clean:
rm -f *.o crc64 gentbl speed
cleanall: clean
rm -f lookup.c
crc64: $(OBJ)
$(CC) -o $@ $(OBJ) $(LDFLAGS)
gentbl: gentbl.o
$(CC) -o $@ gentbl.o
# re-generate lookup.c if needed
lookup.c: gentbl.c
$(CC) -o gentbl gentbl.c
./gentbl > lookup.c
speed: $(SPEED_OBJ)
$(CC) -o $@ $(SPEED_OBJ) $(LDFLAGS)