File: GNUmakefile

package info (click to toggle)
protracker 2.3d.r161-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 3,616 kB
  • sloc: ansic: 38,899; makefile: 51; sh: 43; xml: 23
file content (40 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download
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
# compiler
CC = gcc
# warning options for GCC
WARNINGS = -Wall -Wno-unused-result -Wc++-compat -Wshadow -Winit-self -Wextra -Wunused -Wunreachable-code -Wredundant-decls -Wswitch-default
# source files for compiling
SOURCE = src/gfx/*.c src/*.c
# executable file name
TARGETNAME = protracker
# executable file path
TARGET = release/other/$(TARGETNAME)
# temporary files (for deleting)
CLEAN = src/gfx/*.o src/*.o
# install path
INSTALL = /usr/local/bin/
# name of the user running the make
USER = $(shell whoami)

.PHONY: clean cleanall uninstall

$(TARGET): $(SOURCE)
	@echo "Compiling, please wait..."
	$(CC)  $(SOURCE) $(CFLAGS) $(CPPFLAGS) -lSDL2 -lm $(WARNINGS) -o $(TARGET) $(LDFLAGS)
	@echo "Done! The executable is in the folder named 'release/other'."

run: $(TARGET)
	$(TARGET)

clean:
	@echo "Deleting temporary files..."
	rm $(CLEAN) 2> /dev/null || true

cleanall: clean
	@echo "Deleting executable..."
	rm $(TARGET) 2> /dev/null || true

uninstall:
	@if [ "$(USER)" = "root" ]; then \
		echo "Deleting '$(TARGETNAME)' from $(INSTALL)"; \
		rm "$(INSTALL)/$(TARGETNAME)"; \
	else echo "Please run 'make uninstall' as root"; fi