Home | History | Annotate | Download | only in dosutil
      1 #
      2 # OpenWatcom compile and link utility
      3 #
      4 VPATH = $(SRC)
      5 include $(MAKEDIR)/syslinux.mk
      6 
      7 WCL	= wcl
      8 WCLOPT	= -6 -osx -mt -bt=DOS -l=COM
      9 
     10 WCL_IS_GOOD := $(shell $(WCL) $(WCLOPT) \
     11         -o hello.exe $(SRC)/../win/hello.c >/dev/null 2>&1 ; echo $$?)
     12 
     13 UPX     = upx
     14 
     15 NASM    = nasm
     16 NASMOPT = -Ox
     17 
     18 WCTARGETS = mdiskchk.com
     19 NSTARGETS = eltorito.sys copybs.com
     20 WCOBJS    = $(addprefix $(SRC)/,$(WCTARGETS))
     21 NSOBJS    = $(addprefix $(OBJ)/,$(NSTARGETS))
     22 TARGETS   = $(WCTARGETS) $(NSTARGETS)
     23 
     24 %.obj: %.c
     25 	$(WCL) $(WCLOPT) -c -fo=$@ $<
     26 
     27 %.com: %.obj
     28 	$(WCL) $(WCLOPT) -fe=$@ $<
     29 	$(UPX) --ultra-brute --lzma $@ || \
     30 		$(UPX) --ultra-brute $@ || \
     31 		true
     32 	rm -f $*.0*
     33 	chmod a-x $@
     34 
     35 %.sys: %.asm
     36 	$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
     37 	$(UPX) --ultra-brute --lzma $@ || \
     38 		$(UPX) --ultra-brute $@ || \
     39 		true
     40 	rm -f $*.0*
     41 	chmod a-x $@
     42 
     43 %.com: %.asm
     44 	$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
     45 	$(UPX) --ultra-brute --lzma $@ || \
     46 		$(UPX) --ultra-brute $@ || \
     47 		true
     48 	rm -f $*.0*
     49 	chmod a-x $@
     50 
     51 ifeq ($(WCL_IS_GOOD),0)
     52 all: $(TARGETS)
     53 else
     54 all: $(NSTARGETS)
     55 	rm -f $(WCTARGETS)
     56 endif
     57 
     58 tidy dist:
     59 	-rm -f *.obj *.lst *.o *.0*
     60 
     61 clean: tidy
     62 
     63 spotless: clean
     64 	-rm -f $(NSTARGETS) *~
     65 
     66 installer: all
     67 
     68 install: installer
     69 	mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)/dosutil
     70 	install -m 644 $(WCOBJS) $(INSTALLROOT)$(AUXDIR)/dosutil
     71 	install -m 644 $(NSOBJS) $(INSTALLROOT)$(AUXDIR)/dosutil
     72