2000-12-10 04:09:52 +00:00
|
|
|
#
|
|
|
|
# GNU makefile fragment for building a library
|
|
|
|
#
|
|
|
|
|
|
|
|
CC = gcc
|
2001-05-03 02:24:39 +00:00
|
|
|
NASM = nasm
|
2000-12-10 04:09:52 +00:00
|
|
|
LINK = ar cru
|
|
|
|
LINKD = ld -G
|
|
|
|
LIBPATH = ../../obj/lib
|
|
|
|
STATIC_LIB = $(LIBPATH)/$(LIB_NAME).a
|
|
|
|
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
|
|
|
|
|
|
|
|
all : release
|
|
|
|
|
2001-05-03 00:48:32 +00:00
|
|
|
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
|
|
|
|
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
LFLAGS = -L$(LIBPATH)
|
|
|
|
|
|
|
|
debug : $(STATIC_LIB) $(DYNAMIC_LIB)
|
|
|
|
release : $(STATIC_LIB) $(DYNAMIC_LIB)
|
|
|
|
|
|
|
|
$(STATIC_LIB) : $(OBJS)
|
|
|
|
$(LINK) $@ $(OBJS)
|
|
|
|
|
|
|
|
$(DYNAMIC_LIB) : $(OBJS)
|
|
|
|
$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
%.i : %.c
|
|
|
|
$(CC) $(CFLAGS) -E $< -o $@
|
|
|
|
|
2001-05-25 00:21:42 +00:00
|
|
|
%.o : %.s
|
2001-05-03 02:24:39 +00:00
|
|
|
$(NASM) -f elf -d ELF -i i386/ $< -o $@
|
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
.PHONY : clean
|
|
|
|
clean :
|
|
|
|
-rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB)
|
|
|
|
|
|
|
|
.PHONY : depend
|
|
|
|
depend:
|
|
|
|
makedepend -- $(CFLAGS) $(INCLUDES) -- *.c
|