hpemung/Makefile

60 lines
1.5 KiB
Makefile
Raw Normal View History

PREFIX = /usr
2024-04-15 13:59:42 +02:00
DOCDIR = $(PREFIX)/doc/hpemung
2022-03-22 13:47:02 +01:00
CC = gcc
2023-05-11 16:58:52 +02:00
LIBS = $(shell pkg-config --libs sdl2 SDL2_ttf)
CFLAGS = -Wall -Werror -O3 -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=missing-braces -Wno-error=incompatible-pointer-types
2022-03-22 13:47:02 +01:00
2024-04-10 17:31:49 +02:00
.PHONY: all clean clean-all pretty-code install mrproper get-roms
2022-03-22 13:47:02 +01:00
2024-04-15 13:59:42 +02:00
all: dist/hpemung
2022-03-22 13:47:02 +01:00
2024-04-15 13:59:42 +02:00
dist/hpemung: src/bus.o \
2023-05-11 16:43:32 +02:00
src/cpu.o \
src/display.o \
src/emulator.o \
src/gui.o \
src/hdw.o \
src/keyboard.o \
src/main.o \
src/opcodes.o \
2024-04-15 19:43:28 +02:00
src/persistence.o \
2023-05-11 16:43:32 +02:00
src/ports.o \
src/rpl.o \
src/config.o \
2023-05-11 16:43:32 +02:00
src/timers.o
$(CC) $(CFLAGS) $(LIBS) -o $@ $+
# Cleaning
clean:
-rm src/*.o
2022-03-22 13:47:02 +01:00
2023-10-03 13:24:52 +02:00
mrproper: clean
2024-04-15 13:59:42 +02:00
-rm dist/hpemung
2022-03-22 13:47:02 +01:00
2023-10-03 13:24:52 +02:00
clean-all: mrproper
2023-05-11 16:43:32 +02:00
# Formatting
pretty-code:
clang-format -i src/*.c src/*.h
# Installing
get-roms:
make -C dist/ROMs get-roms
install: all get-roms
install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin
2024-04-15 13:59:42 +02:00
install -c -m 755 dist/hpemung $(DESTDIR)$(PREFIX)/bin/hpemung
2024-04-15 13:59:42 +02:00
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/hpemung
install -c -m 644 dist/hplogo.png $(DESTDIR)$(PREFIX)/share/hpemung/hplogo.png
cp -R dist/ROMs/ $(DESTDIR)$(PREFIX)/share/hpemung/
sed "s|@PREFIX@|$(PREFIX)|g" dist/setup-hpemung-home.sh > $(DESTDIR)$(PREFIX)/share/hpemung/setup-hpemung-home.sh
chmod 755 $(DESTDIR)$(PREFIX)/share/hpemung/setup-hpemung-home.sh
install -m 755 -d -- $(DESTDIR)$(DOCDIR)
cp -R ./*.txt $(DESTDIR)$(DOCDIR)
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/applications
2024-04-15 13:59:42 +02:00
sed "s|@PREFIX@|$(PREFIX)|g" dist/hpemung.desktop > $(DESTDIR)$(PREFIX)/share/applications/hpemung.desktop