-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
51 lines (37 loc) · 871 Bytes
/
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
48
49
50
51
#!/usr/bin/env make -f
AR := ar
CC := clang
LD := ld
LIBS := -lm -lc
CFLAGS := -O
LDFLAGS := -dylib
OUT_LIB_STATIC := minify.a
OUT_LIB_DYNAMIC := minify.so
OUT_EXE := minify.exe
default: binary
all: dynamic static binary
static: $(OUT_LIB_STATIC)
dynamic: $(OUT_LIB_DYNAMIC)
binary: $(OUT_EXE)
clean: $(OUT_EXE) $(OUT_LIB_STATIC) $(OUT_LIB_DYNAMIC)
rm -rf $^ test.*
$(OUT_EXE): $(OUT_LIB_STATIC)
$(CC) -o $@ $< main.c
%.so %.dylib: %.o
$(LD) $(LDFLAGS) $(LIBS) -o $@ $<
%.a: %.o
$(AR) -rsuv $@ $<
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
test.%: $(OUT_EXE)
dd if=/dev/zero bs=1024 count=1000 | tr \\0 $* > $@
shasum $@
./$(OUT_EXE) $@ [email protected]
shasum $@
test.0: $(addprefix test., 1 2 3 4 5 6 7 8 9)
cat $^ > $@
shasum $@
./$(OUT_EXE) $@ [email protected]
shasum $@
test: test.0
true