2 # Makefile.rules - Common Makefile rules to build pic16
5 # This file is part of the GNU PIC Library.
8 # The GNU PIC Library is maintained by,
9 # Vangelis Rokas <vrokas@otenet.gr>
16 include ../../Makefile.common
18 PRJDIR = ../../../../..
20 LIBC_INC_DIR = $(PRJDIR)/device/include/pic16
24 OPT_FLAGS += --optimize-cmp
25 #OPT_FLAGS += --stack-auto
27 COMPILE_FLAGS += $(MODELFLAGS)
28 COMPILE_FLAGS += $(OPT_FLAGS) $(DEBUG)
29 COMPILE_FLAGS += $(CSTD)
31 CPPFLAGS := -nostdinc $(CFLAGS) -I$(LIBC_INC_DIR)
33 CFLAGS += --nostdinc -I$(LIBC_INC_DIR)
36 CFILES = $(patsubst %,%.c,$(SRCS))
37 COFILES = $(patsubst %.c,%.o,$(CFILES))
39 SFILES = $(patsubst %,%.S,$(AS_SRCS))
40 SOFILES = $(patsubst %.S,%.o,$(SFILES))
42 OFILES = $(COFILES) $(SOFILES)
45 $(CC) $(CFLAGS) $(COMPILE_FLAGS) -c $<
48 $(AS) -I $(LIBC_INC_DIR) -c $<
51 all: build-library clean-intermediate-no-asm
54 $(RM) -f *.lst *.asm *.dump* *.p *.d *.adb
56 clean-intermediate-no-asm:
57 $(RM) -f *.lst *.dump* *.p *.d *.adb
59 clean: clean-intermediate
64 for temp in $(CFILES); do \
65 $(CPP) $(MM) $(CPPFLAGS) $$temp > .tmpdepend; \
66 $(SED) s/.rel/.o/g .tmpdepend >> .depend; \
67 $(RM) -f .tmpdepend; \
69 if [ ! -e .depend ]; then touch .depend ; fi ;