blob: 3b0de220c56e853ba31234e6af76ce9e36d2ce93 (
plain) (
blame)
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
|
NAME := HALK
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
BIN := $(shell echo $(NAME) | tr '[:upper:]' '[:lower:]')
TMPBIN := $(BIN).out
CC := gcc
FLAGS := -O3 -s
DEVFLAGS := -ggdb -fsanitize=leak,address,undefined -fno-omit-frame-pointer
SRCS := $(wildcard src/*.c)
#SRCS := $(filter-out src/parser.c, $(SRCS)) # exclude the incomplete parser for now.
OBJS := $(SRCS:.c=.o)
all: options HALK
options:
@$(eval $@_TITLE := "$(NAME) build options")
@$(eval $@_ULINE := $(shell echo "$($@_TITLE)" | tr '[:print:]' '='))
@echo "$($@_TITLE)"
@echo "$($@_ULINE)"
@echo "cc: $(CC)"
@echo "flags: $(FLAGS)"
@echo ""
devoptions:
@$(eval $@_TITLE := "$(NAME) build options \(development\)")
@$(eval $@_ULINE := $(shell echo "$($@_TITLE)" | tr '[:print:]' '='))
@echo "$($@_TITLE)"
@echo "$($@_ULINE)"
@echo "cc: $(CC)"
@echo "flags: $(DEVFLAGS)"
@echo ""
HALK: $(OBJS)
$(CC) $(OBJS) $(FLAGS) -o $(TMPBIN)
dev: devoptions $(OBJS)
$(CC) $(OBJS) $(DEVFLAGS) -o $(TMPBIN)
install:
make
cp ./$(BIN).out $(BINDIR)/$(BIN)
uninstall:
rm -f $(BINDIR)/$(BIN)
clean:
rm -f $(TMPBIN) src/*.o
%.o: %.c include/%.h
$(CC) -c $(FLAGS) $< -o $@
me:
@[ "$(USER)" = "root" ] && echo "Okay." || echo "What? Make it yourself."
a sandwich:
@exit
.PHONY: all options devoptions dev install uninstall clean
|