Banner/Makefile
2023-12-08 17:20:48 +01:00

51 lines
1.1 KiB
Makefile

PR = banner
VPATH = .
PREFIX =
CC = $(PREFIX)gcc
CX = $(PREFIX)g++
AS = $(PREFIX)as
AR = $(PREFIX)ar
LD = $(PREFIX)ld
SIZE = $(PREFIX)size
DUMP = $(PREFIX)objdump
COPY = $(PREFIX)objcopy
BLD= ./bld/
AFLAGS = -adhlns=$(@:%.o=%.lst)
#CFLAGS =
CFLAGS = -Os -Wall
CFLAGS+= -fno-exceptions -fno-unwind-tables -fno-stack-check
CFLAGS+= -Wa,-adhlns=$(@:%.o=%.lst)
XFLAGS = $(CFLAGS)
XFLAGS+= -fno-rtti
LFLAGS = -lsndfile
LDLIBS =
# startup musí být linkován první
SOURCES = banner.c fft.cpp main.cpp
WIDTH = 80
OBJS = $(addsuffix .o,$(basename $(SOURCES)))
BOBJS = $(addprefix $(BLD),$(OBJS))
all: $(BLD) $(PR)
banner.c: font.h
font.h: ./mkfont
./mkfont --width $(WIDTH) --font /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf
./mkfont:
gcc -Os -Wall -I/usr/include/freetype2 mkfont.c -o mkfont -lfreetype
$(BLD):
mkdir $(BLD)
# build native application
$(PR): $(BOBJS)
$(CX) -o $(PR) $(BOBJS) $(LFLAGS)
$(BLD)%.o: %.c
$(CC) -std=c11 -c $(CFLAGS) -o $@ $<
$(BLD)%.o: %.cpp
$(CX) -c $(XFLAGS) -o $@ $<
$(BLD)%.o: %.s
$(AS) $(AFLAGS) -o $@ $<
clean:
rm -f $(BLD)* $(PR)
distclean: clean
rm -f ./mkfont font.h
rm -f *.vaw *.mp3