forked from andik/makeheaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 815 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
CC ?= cc
PREFIX ?= /usr/local
ifeq ($(OS),Windows_NT)
BINS = makeheaders.exe
LDFLAGS =
CP = copy /Y
RM = del /Q /S
MKDIR_P = mkdir
else
BINS = makeheaders
LDFLAGS =
CP = cp -f
RM = rm -f
MKDIR_P = mkdir -p
endif
SRC = $(wildcard src/*.c)
DEPS = $(wildcard deps/*/*.c)
OBJS = $(DEPS:.c=.o)
CFLAGS = -std=c99 -Ideps -Wall -Wno-unused-function -U__STRICT_ANSI__
all: $(BINS)
$(BINS): $(SRC) $(OBJS)
$(CC) $(CFLAGS) -o $@ src/$(@:.exe=).c $(OBJS) $(LDFLAGS)
%.o: %.c
$(CC) $< -c -o $@ $(CFLAGS)
clean:
$(foreach c, $(BINS), $(RM) $(c);)
$(RM) $(OBJS)
install: $(BINS)
$(MKDIR_P) $(PREFIX)/bin
$(foreach c, $(BINS), $(CP) $(c) $(PREFIX)/bin/$(c);)
uninstall:
$(foreach c, $(BINS), $(RM) $(PREFIX)/bin/$(c);)
test:
@./test.sh
.PHONY: test all clean install uninstall