mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 17:49:32 +08:00
80 lines
1.6 KiB
Text
80 lines
1.6 KiB
Text
# Hide full compilation line:
|
|
ifneq ($(V),1)
|
|
Q?=@
|
|
endif
|
|
# To see full command lines, use make V=1
|
|
|
|
CC = gcc
|
|
LD = gcc
|
|
RM = rm -f
|
|
MV = mv
|
|
CP = cp -a
|
|
MKDIR = mkdir -p
|
|
TOUCH = touch
|
|
FALSE = false
|
|
|
|
CFLAGS ?= -Wall -Werror -O3
|
|
CFLAGS += $(MYDEFS) $(MYCFLAGS) $(MYINCLUDES)
|
|
ifneq (,$(PM3_BIN_PATH))
|
|
CFLAGS += -DPM3_BIN_PATH=\"$(PM3_BIN_PATH)\"
|
|
endif
|
|
ifneq (,$(PM3_SHARE_PATH))
|
|
CFLAGS += -DPM3_SHARE_PATH=\"$(PM3_SHARE_PATH)\"
|
|
endif
|
|
|
|
platform = $(shell uname)
|
|
|
|
ifeq ($(platform),Darwin)
|
|
AR= /usr/bin/ar rcs
|
|
RANLIB= /usr/bin/ranlib
|
|
else
|
|
AR= ar rcs
|
|
RANLIB= ranlib
|
|
endif
|
|
RM= rm -f
|
|
RMDIR= rm -rf
|
|
|
|
vpath %.c $(MYSRCPATHS)
|
|
|
|
# Flags to generate temporary dependency files
|
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
|
|
# make temporary to final dependency files after successful compilation
|
|
POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d && $(TOUCH) $@
|
|
|
|
BINDIR := .
|
|
OBJDIR := obj
|
|
|
|
MYOBJS = $(MYSRCS:%.c=$(OBJDIR)/%.o)
|
|
CLEAN = $(foreach bin,$(MYLIBS) $(BINS) $(LIB_A),$(BINDIR)/$(bin))
|
|
|
|
all: $(foreach bin,$(MYLIBS) $(BINS) $(LIB_A),$(BINDIR)/$(bin))
|
|
|
|
clean:
|
|
$(Q)$(RM) $(CLEAN)
|
|
$(Q)$(RMDIR) $(OBJDIR)
|
|
|
|
.PHONY: all clean
|
|
|
|
$(BINDIR)/$(LIB_A): $(MYOBJS)
|
|
$(info [=] AR $(notdir $@))
|
|
$(Q)$(AR) $@ $(MYOBJS)
|
|
$(Q)$(RANLIB) $@
|
|
|
|
$(BINDIR)/% : $(OBJDIR)/%.o $(MYOBJS) $(MYLIBS)
|
|
$(info [=] LD $(notdir $@))
|
|
$(Q)$(LD) $(LDFLAGS) $(MYOBJS) $< -o $@ $(MYLIBS)
|
|
|
|
$(OBJDIR)/%.o : %.c | $(OBJDIR)
|
|
$(info [-] CC $<)
|
|
$(Q)$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
|
|
$(Q)$(POSTCOMPILE)
|
|
|
|
$(OBJDIR):
|
|
$(Q)$(MKDIR) $(OBJDIR)
|
|
|
|
DEPENDENCY_FILES = $(MYOBJS:%.o=%.d) $(BINS:%=$(OBJDIR)/%.d)
|
|
|
|
$(DEPENDENCY_FILES): ;
|
|
.PRECIOUS: $(DEPENDENCY_FILES)
|
|
|
|
-include $(DEPENDENCY_FILES)
|