Something like:
program_NAME := a.out SRCS = mylib.c prog.c .PHONY: all all: $(program_NAME) $(program_NAME): $(SRCS) ar -rcs libmylib.a mylib.o cc -m32 prog.o -L. -lmylib
could start
I just started using make files myself, and I think they are quite complicated, but as soon as you earn them, they make life much easier (these problems are full of errors, but some of the more experienced SO people will have the opportunity to help fix them)
As for launching, make sure you save the file as a βMakefileβ (case is important)
then from the cmd line (make sure you cd in the directory containing the Makefile):
$ make
here it is!
UPDATE
If the intermediate static library is redundant, you can skip it using the Makefile as follows:
program_NAME := a.out SRCS = mylib.c prog.c OBJS := ${SRCS:.c=.o} CFLAGS += -m32 program_INCLUDE_DIRS := program_LIBRARY_DIRS := program_LIBRARIES := mylib CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir)) LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library)) CC=cc LINK.c := $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) .PHONY: all all: $(program_NAME) $(program_NAME): $(OBJS) $(LINK.c) $(program_OBJS) -o $(program_NAME)
bph
source share