-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 764 Bytes
/
Makefile
File metadata and controls
36 lines (26 loc) · 764 Bytes
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
-include config.mk
TARGET ?= petool
CFLAGS ?= -O2 -std=c99 -pedantic -Wall -Wextra
LDFLAGS ?= -s
COMMIT := $(shell git describe --match=NeVeRmAtCh --always --dirty)
CFLAGS += -DGIT_COMMIT=\"$(COMMIT)\"
ifeq ($(DESTDIR)$(PREFIX),)
PREFIX = /usr/local
endif
ifneq ($(CROSS_COMPILE),)
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
STRIP = $(CROSS_COMPILE)strip
endif
SRCS := $(wildcard src/*.c) src/incbin.S
OBJS := $(addsuffix .o, $(basename $(SRCS)))
.PHONY: clean all install
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
clean:
$(RM) $(TARGET) $(OBJS) || del $(TARGET) $(subst /,\\,$(OBJS))
install: $(TARGET)
install $(TARGET) $(DESTDIR)$(PREFIX)/bin/
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/$(TARGET)