This repository has been archived on 2024-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
trixy/trixy-macros/example/main/Makefile

36 lines
738 B
Makefile
Raw Normal View History

PREFIX := /usr/local
BINPREFIX := $(DESTDIR)$(PREFIX)/bin
MANPREFIX := $(DESTDIR)$(PREFIX)/share/man/man1
BIN_NAME := libmain.so
SRC := $(wildcard c_src/*.c)
OBJ := $(SRC:.c=.o)
DEP := $(OBJ:.o=.d)
LIBS := main-example
ALL_CFLAGS := -fPIC -O3 -MMD -Wall -Wextra -Wno-unused-parameter $(CFLAGS) $(CPPFLAGS)
ALL_LDFLAGS := -shared $(addprefix -l,$(LIBS)) -L $(LD_LIBRARY_PATH) $(CFLAGS) $(LDFLAGS)
$(BIN_NAME): $(OBJ)
$(CC) -o $@ $+ $(ALL_LDFLAGS)
.c.o:
$(CC) -o $@ $< -c $(ALL_CFLAGS)
.PHONY : clean options
options:
@echo "CC = $(CC)"
@echo "CFLAGS = $(ALL_CFLAGS)"
@echo "LDFLAGS = $(ALL_LDFLAGS)"
@echo "SRC = $(SRC)"
@echo "OBJ = $(OBJ)"
@echo "DEP = $(DEP)"
@echo ""
clean :
rm $(BIN_NAME) $(OBJ) $(DEP)