I am quite new to both writing a makefiles and Objective-C language. I am trying to compile a small test application with this Makefile:
Q = @
INCLUDE_PREF = -I
CC := gcc
#Here the source files are specified
list_src_files = $(shell find . -type f -name "*.m")
SRCS := $(subst ./,,$(call list_src_files))
#Here is our include files
list_include_dirs = $(shell find . -type d -name "include")
INCLUDE_LS := $(call list_include_dirs)
INCLUDE_DIRS := $(INCLUDE_PREF).
INCLUDE_DIRS += $(addprefix $(INCLUDE_PREF), $(subst ./,,$(INCLUDE_LS)))
#Flags used with gcc
CFLAGS = -Wall -fobjc-arc -framework Foundation -g -O0 $(INCLUDE_DIRS)
#Here all object files are specified
OBJS := $(SRCS:%.m=%.o)
#Here is the name of target specified
TARGET := Convertor
#Here is our target
$(TARGET): $(OBJS)
@echo "Building target"
$(Q)$(CC) $(CFLAGS) $^ -o $@
%.o: %.m
@echo "Building objects"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(Q)-rm $(OBJS) $(TARGET) 2>/dev/null || true
The code I am trying to compile is:
#import <Foundation/Foundation.h>
#define DEBUG
#define VALID_PARMS_NBR 3
#ifdef DEBUG
# define dbg(fmt, ...) NSLog((@"%s " fmt), __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else
# define dbg(...)
#endif
int main (int argc, char *argv[])
{
if (argc < VALID_PARMS_NBR) {
NSLog(@"Usage of this program is: prog_name arg1 arg2");
} else {
dbg(@"Parameters: %s, %s, %s\n", argv[0], argv[1], argv[2]);
}
return 0;
}
The warning compiler is throwing me everytime:
clang: warning: -framework Foundation: 'linker' input unused
Could you, please, point me, where I did mistake in a Makefile? And why this warning appears?
I was looking through the similar questions, but nothing worked.