Skip to content

Commit

Permalink
build: move utils to fdpp [dosemu2#16]
Browse files Browse the repository at this point in the history
Now the freedos source tree is completely clean from
any fdpp files.
  • Loading branch information
stsp committed Jul 18, 2018
1 parent 69e5f90 commit 58b3bef
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
22 changes: 13 additions & 9 deletions fdpp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ kernel.exe: $(OBJS) $(PPOBJS) $(LIBS)
$(NASM) -o $@ $<

clean:
-$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.cod *.err \
*.lnk *.o $(GEN_CC) *.so *.tmp $(GEN_HEADERS) $(GEN_ASMS) \
plt*.inc kernel.exe kernel.sys
cd utils && make clean
-$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.cod *.err \
*.lnk *.o $(GEN_CC) *.so *.tmp $(GEN_HEADERS) $(GEN_ASMS) \
plt*.inc kernel.exe kernel.sys kernel.sym

# *Individual File Dependencies*
apisupt.obj: $(SRC)apisupt.asm $(SRC)segs.inc
Expand Down Expand Up @@ -136,7 +137,7 @@ $(OBJECTS): %.o: %.cc $(HEADERS)
$(FDPP_COBJS): %.o: %.c $(PPHDRS)
$(CLC) $(CFLAGS) -o $@ $<

$(FDPP_CCOBJS): %.o: %.cc $(PPHDRS)
$(FDPP_CCOBJS): %.o: %.cc $(PPHDRS) $(GEN_HEADERS)
$(CC) $(CFLAGS) -o $@ $<

$(OBJS): %.obj: $(SRC)%.asm
Expand All @@ -149,7 +150,7 @@ $(PPOBJS): %.obj: %.asm
$(CC) $(CFLAGS) -o $@ $<

$(CFILES:.c=.cc): %.cc: $(SRC)%.c makefile
../utils/mkfar.sh FAR __FAR $< >$@
utils/mkfar.sh FAR __FAR $< >$@

$(FDPPLIB): $(OBJECTS) $(FDPP_COBJS) $(FDPP_CCOBJS) $(CPPFILES:.cpp=.o)
$(CL) $(LDFLAGS) -o $@ $^
Expand All @@ -171,15 +172,15 @@ plt.inc: thunk_calls.tmp
grep ") FAR " $< | sed 's/\([0-9]\+\).\+ \(SEGM(\(.\+\))\).* \([^ (]\+\) *(.*/asmcfunc_f \4,\t\t\1,\t\3/' >$@
grep -v ") FAR " $< | sed 's/\([0-9]\+\).\+ \(SEGM(\(.\+\))\).* \([^ (]\+\) *(.*/asmcfunc_n \4,\t\t\1,\t\3/' >>$@

thunk_calls.h: thunk_calls.tmp
cat $^ | ../utils/thunk_gen >$@ || (rm -f $@ ; false)
thunk_calls.h: thunk_calls.tmp utils/thunk_gen
cat $< | utils/thunk_gen >$@ || (rm -f $@ ; false)

thunk_asms.tmp: $(SRC)proto.h makefile
grep 'ASMFUNC\|ASMPASCAL' $< | grep -v "//" | \
sed 's/__FAR(\([^)]\+\))/\1 FAR */g' | nl -n ln -v 0 >$@

thunk_asms.h: thunk_asms.tmp makefile
cat $< | ../utils/thunk_gen 1 >$@ || (rm -f $@ ; false)
thunk_asms.h: thunk_asms.tmp utils/thunk_gen
cat $< | utils/thunk_gen 1 >$@ || (rm -f $@ ; false)

plt_asmc.inc: thunk_asms.tmp makefile
grep ASMFUNC $< | sed 's/\([0-9]\+\).\+ \([^ (]\+\) *(.\+/asmcsym \2,\t\t\1/' >$@
Expand All @@ -203,6 +204,9 @@ glob_asmdefs.h: glob_asm.h makefile
grep "__ASM_FUNC(" $< | grep -v '^/' | \
sed 's/.\+(\(.\+\)).*/#define \1 __ASYM(__\1)/' >>$@

utils/thunk_gen:
cd utils && make

install: $(FDPPLIB)
install -t /usr/local/lib $(FDPPLIB)
install -D -m 0644 -t /usr/local/include/fdpp thunks.h
15 changes: 15 additions & 0 deletions fdpp/utils/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
XCPU ?= 386
include ../../mkfiles/gcc.mak

thunk_gen: lex.yy.c thunk_gen.tab.c
$(CLC) -g -o $@ $^

thunk_gen.tab.c: thunk_gen.y
bison -d $^

lex.yy.c: thunk_gen.l
lex $^

clean:
$(RM) *.tab.* lex.yy.c thunk_gen

File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 2 additions & 12 deletions utils/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,17 @@ include ../mkfiles/generic.mak

CFLAGS = -iquote..$(DIRSEP)hdr

production: patchobj.com exeflat.exe thunk_gen
production: patchobj.com exeflat.exe

patchobj.com: patchobj.c
$(CLT) $(CFLAGS) -o $@ patchobj.c

exeflat.exe: exeflat.c ../hdr/exe.h
$(CLC) $(CFLAGS) -o $@ exeflat.c

thunk_gen: lex.yy.c thunk_gen.tab.c
$(CLC) -g -o $@ $^

thunk_gen.tab.c: thunk_gen.y
bison -d $^

lex.yy.c: thunk_gen.l
lex $^

clobber: clean

clean:
$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me
$(RM) *.tab.*
$(RM) exeflat.exe patchobj.com thunk_gen
$(RM) exeflat.exe patchobj.com

0 comments on commit 58b3bef

Please sign in to comment.