aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'com32/modules/Makefile')
-rw-r--r--com32/modules/Makefile31
1 files changed, 21 insertions, 10 deletions
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index ed4e386d..f02a5143 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -25,14 +25,17 @@ LD = ld -m elf_i386
AR = ar
NASM = nasm
RANLIB = ranlib
-CFLAGS = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../include -D__COM32__
-LNXCFLAGS = -W -Wall -march=i386 -Os -g
-SFLAGS = -march=i386
+CFLAGS = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
+LNXCFLAGS = -W -Wall -march=i386 -Os -g -I../libutil/include
+LNXSFLAGS = -march=i386
+LNXLDFLAGS = -g
+SFLAGS = -D__COM32__ -march=i386
LDFLAGS = -T ../lib/com32.ld
OBJCOPY = objcopy
PPMTOLSS16 = ../ppmtolss16
-LIB = ../lib/libcom32.a
LIBGCC := $(shell $(CC) --print-libgcc)
+LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
+LNXLIBS = ../libutil/libutil_lnx.a
.SUFFIXES: .lss .c .o .elf .c32 .lnx
@@ -47,21 +50,29 @@ all: hello.c32 fancyhello.c32 fancyhello.lnx
$(CC) $(CFLAGS) -c -o $@ $<
.PRECIOUS: %.elf
-%.elf: %.o $(LIB)
- $(LD) $(LDFLAGS) -o $@ $^ $(LIBGCC)
+%.elf: %.o $(LIBS)
+ $(LD) $(LDFLAGS) -o $@ $^
+
+.PRECIOUS: %.lo
+%.lo: %.S
+ $(CC) $(LNXSFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.lo
+%.lo: %.c
+ $(CC) $(LNXCFLAGS) -c -o $@ $<
.PRECIOUS: %.lnx
-%.lnx: %.c
- $(CC) $(LNXCFLAGS) -o $@ $^
+%.lnx: %.lo $(LNXLIBS)
+ $(CC) $(LNXLDFLAGS) -o $@ $^
%.c32: %.elf
$(OBJCOPY) -O binary $< $@
tidy:
- rm -f *.o *.a *.lst *.elf
+ rm -f *.o *.lo *.a *.lst *.elf
clean: tidy
- rm -f *.lss *.o *.c32 *.lnx *.com
+ rm -f *.lss *.c32 *.lnx *.com
spotless: clean
rm -f *~ \#*