aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: fa953ca946b16964621c2cd8545b08a517cb92cf (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
PREFIX			:= /usr/local
BINDIR			:= $(PREFIX)/bin
BIN 				:= halk
TMPBIN			:= halk.out
CC					:= gcc
FLAGS				:=
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:
	@echo "HALK build options		"
	@echo "==================		"
	@echo "cc:				$(CC)		"
	@echo "flags:			$(FLAGS)	"
	@echo "								"

devoptions:
	@echo "HALK build options (development)		"
	@echo "================================		"
	@echo "cc:				$(CC)							"
	@echo "flags:			$(DEVFLAGS)					"
	@echo "													"

HALK: $(OBJS)
	$(CC) $(OBJS) $(FLAGS) -o $(TMPBIN)

dev: $(OBJS)
	@make devoptions
	$(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 $@

# fun
me:
	@[ "$(USER)" = "root" ] && echo "Okay." || echo "What? Make it yourself."

a sandwich:
	@exit

.PHONY: all options devoptions dev install uninstall clean