quest/Makefile

39 lines
926 B
Makefile
Raw Normal View History

2021-09-05 02:50:19 +10:00
TARGET = quest
2021-08-28 01:43:33 +10:00
LIBS = -lm -luiohook
2021-08-11 23:50:59 +10:00
CC = gcc
CFLAGS = -g -Wall
INSTALL_PATH = /usr/local
VERSION = 0.5.0
2021-08-11 23:50:59 +10:00
.PHONY: default all clean
default: $(TARGET)
all: default
2021-09-17 09:25:36 +10:00
OBJECTS = $(patsubst src/%.c, %.o, $(wildcard src/*.c))
2021-08-11 23:50:59 +10:00
HEADERS = $(wildcard *.h)
2021-09-17 09:25:36 +10:00
%.o: src/%.c $(HEADERS)
2021-08-11 23:50:59 +10:00
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@
clean:
-rm -f *.o
-rm -f $(TARGET)
install: all
mkdir -p $(DESTDIR)$(INSTALL_PATH)/bin
cp -f $(TARGET) $(DESTDIR)$(INSTALL_PATH)/bin
chmod 755 $(DESTDIR)$(INSTALL_PATH)/bin/$(TARGET)
mkdir -p $(DESTDIR)$(INSTALL_PATH)/share/man/man1
sed "s/VERSION/$(VERSION)/g" < docs/$(TARGET).1 > $(DESTDIR)$(INSTALL_PATH)/share/man/man1/$(TARGET).1
chmod 644 $(DESTDIR)$(INSTALL_PATH)/share/man/man1/$(TARGET).1
uninstall:
rm -f $(DESTDIR)$(INSTALL_PATH)/bin/$(TARGET)\
$(DESTDIR)$(INSTALL_PATH)/share/man/man1/$(TARGET).1