aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 2a1c7f475300ea1f52df4460b831480e41c7413e (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
.PHONY: install uninstall clean me a sandwich dev

name 				:= halk
cc 				:= cc
flags 			:= -s
devflags			:= -g
sources 			:= $(wildcard src/*.c)
sources 			:= $(filter-out src/parser.c, $(sources)) # exclude the incomplete parser for now.
objects 			:= $(sources:.c=.o)
tests				:= tests

$(name): $(objects)
	$(cc) $(objects) $(flags) -o ./$(name).out

dev: $(objects)
	$(cc) $(objects) $(devflags) -o ./$(name).out

%.o: %.c include/%.h
	$(cc) -c $(flags) $< -o $@

install:
	make
	cp ./$(name).out /usr/local/bin/$(name)

uninstall:
	rm -f /usr/local/bin/$(name)

clean:
	rm -f ./$(name).out ./src/*.o

test:
	@$(foreach file, $(wildcard $(tests)/*.test.sh), $(file);)

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

a sandwich:
	@exit