From: ian Date: Sun, 20 Nov 2005 23:57:41 +0000 (+0000) Subject: massive makefile rearrangements and improvements X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=b5fa66662e95e09145be047bb7446033d97e8b64;p=trains.git massive makefile rearrangements and improvements --- diff --git a/Makefile b/Makefile index 8eb1034..39bf7c0 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,27 @@ -all: pic hostprogs +recurse = set -e; for f in $($(1)_DIRS); do $(MAKE) -C $$f $(2); done -PICPROGS_DIRS= iwjpictest cebpic detpic -HOSTPROGS_DIRS= layout hostside +PIC_DIRS= iwjpictest cebpic detpic +HOST_DIRS= layout hostside + +all: + $(call recurse,HOST,recurse) + $(call recurse,PIC,) + +host: host_recurse + +host_%: + $(call recurse,HOST,$*) pic: - set -e; for f in $(PICPROGS_DIRS); do $(MAKE) -C $$f; done + $(MAKE) -C layout for-pic + $(call recurse,PIC,) pic_%: - set -e; for f in $(PICPROGS_DIRS); do $(MAKE) -C $$f $*; done + $(MAKE) -C layout for-pic + $(call recurse,PIC,$*) + +pic_clean: + $(call recurse,PIC,clean) -hostprogs: - set -e; for f in $(HOSTPROGS_DIRS); do $(MAKE) -C $$f; done +clean: host_clean pic_clean diff --git a/cebpic/.cvsignore b/cebpic/.cvsignore index c0c7dd7..13f1d62 100644 --- a/cebpic/.cvsignore +++ b/cebpic/.cvsignore @@ -1,10 +1,12 @@ -*.hex +*+morse.asm *.cod +*.hex *.lst *.map -idlocs*.asm +.submakefile +blank[0246].asm gpsim.log -routines.lib -morse-auto.asm -morse-auto.inc +idlocs*.asm +morse+auto.inc ours-pindata.asm +routines.lib diff --git a/cebpic/Makefile b/cebpic/Makefile index 5bd2259..0a9ea5e 100644 --- a/cebpic/Makefile +++ b/cebpic/Makefile @@ -1,18 +1,17 @@ -PROGRAMS= led-flash send-serial panic reply-serial \ - nmra-stream nmra-stream,slow tblrd_test \ - i2c-test i2c-test,slow -# booster-output-low -disabled because you forgot to cvs add it -INCLUDES= common.inc morse-auto.inc ../iwjpictest/insn-aliases.inc -LIBS= routines.lib +CEBPIC= ./ PICNOS= 0 1 3 -include manypics.make +PROGRAMS= led-flash send-serial panic reply-serial \ + nmra-stream nmra-stream,slow tblrd_test \ + i2c-test i2c-test,slow ROUTINES= routines-led +LIBS= routines.lib -clean: manypic-clean - rm -f routines.lib +INCLUDES= common.inc pindata.inc + +include manypics.make routines.lib: $(addsuffix .o, $(ROUTINES)) rm -f $@.new @@ -25,3 +24,6 @@ i2c-test-reply,slow.hex: i2c-test-reply,slow.o morse-auto.o %,slow.o: %.asm $(ASSEMBLE) -D SLOW_VERSION -c -o $@ $< + +clean: manypic-clean + rm -f routines.lib diff --git a/cebpic/manypics.make b/cebpic/manypics.make index 0fe7178..9dbb085 100644 --- a/cebpic/manypics.make +++ b/cebpic/manypics.make @@ -1,21 +1,79 @@ +default: all + +#---------- bizarre macro arrangements for $(PROGRAMS) ---------- + +define define_prog + +TARGETS += $(1)+code.hex $(1)+program.hex $(1)+program.map +TARGETS += $$(foreach i, $$(PICNOS), $(1)+entire$$i.hex) + +$(1)_CODEHEX= $$(foreach panel, $$(XCODEN_$(1)), $(1)+$$(panel).hex) \ + $$(foreach panel, $$(XCODE1_$(1)), $$(panel).hex) + +$(1)+code.hex: $(1)+program.hex $($(1)_CODEHEX) + $$(MERGEHEX) + +$(1)+entire%.hex: $(1)+program.hex $($(1)_CODEHEX) idlocs%.hex config.hex + $$(MERGEHEX) + +$(1)+program.hex: $(1).o $(OBJS_$(prog)) $(LIBS) + $$(LINK) + +endef + +define define_directasm + +$(1).hex: $(1).asm + $$(ASSEMBLE) $$< +endef + +define makesubmakefile +set -e; d=.submakefile.new; rm -f $$d; for f in "$$@";do echo "$$f" >>$$d; done +-- +$(foreach prog, $(PROGRAMS), $(call define_prog,$(prog))) +$(foreach da, idlocs% config %+morse blank%, $(call define_directasm,$(da))) +endef + +.submakefile: $(CEBPIC)manypics.make Makefile + : $(shell $(makesubmakefile)) ... generate .submakefile + @mv -f $@.new $@ + +ifneq ($(MAKECMDGOALS),clean) +include .submakefile +endif + +blank0.asm blank2.asm blank4.asm blank6.asm: blank%.asm: $(CEBPIC)manypics.make + echo >$@.new " org 0x$*000" + echo >>$@.new " nop" + echo >>$@.new " end" + mv -f $@.new $@ + +#---------- general definitions etc. ---------- + +TARGETS += $(foreach i, $(PICNOS), idlocs$i.hex noncode$i.hex) +MORSE_INCLUDE ?= common.inc +INCLUDES += ../iwjpictest/insn-aliases.inc morse+auto.inc +MERGEHEX= $(CEBPIC)merge-hex $^ $o + include ../common.make include ../pic.make -perpic%.hex: config.o idlocs%.o - $(LINK) +#---------- targets ---------- -morse-auto.inc: $(CEBPIC)morse-auto.asm-gen morse-auto.messages - ./$^ inc $o +all: $(TARGETS) -%-automorse.asm: $(CEBPIC)morse-auto.asm-gen morse-auto.messages %-bare.map - ./$^ asm $o +noncode%.hex: idlocs%.hex config.hex + $(MERGEHEX) + +morse+auto.inc: $(CEBPIC)morse-generator morse.messages + ./$^ inc $o -%-bare.map: %.o $(LIBS) - gplink -m -o $*-bare.hex $^ +%+morse.asm: $(CEBPIC)morse-generator morse.messages %+program.map + ./$^ asm -I$(MORSE_INCLUDE) $o -%-entire0.hex: %.o config.o idlocs0.o $(LIBS) $(DEFLIBS) - $(LINK) +%.map: %.hex + @: idlocs%.asm: $(CEBPIC)make-idlocs ./$< $* >$@.new && mv -f $@.new $@ @@ -24,6 +82,6 @@ ours-pindata.asm: ../layout/ours-pindata.asm cp $< $@ manypic-clean: pic-clean - rm -f idlocs*.asm *.map *-automorse.* + rm -f idlocs*.asm *+morse.* morse+auto.inc blank[0246].* -.PRECIOUS: idlocs%.asm %-bare.map %-automorse.asm +.PRECIOUS: idlocs%.asm morse+auto.inc %+morse.asm %+morse.hex %.map diff --git a/cebpic/merge-hex b/cebpic/merge-hex new file mode 100755 index 0000000..03df2d3 --- /dev/null +++ b/cebpic/merge-hex @@ -0,0 +1,10 @@ +#!/usr/bin/perl +$end= ':00000001FF'; +while (<>) { + chomp; + next if uc $_ eq $end; + print or die $!; + print "\n" or die $!; +} +print $end or die $!; +print "\n" or die $!; diff --git a/cebpic/morse-auto.fin b/cebpic/morse-auto.fin deleted file mode 100644 index 9bbe3c4..0000000 --- a/cebpic/morse-auto.fin +++ /dev/null @@ -1 +0,0 @@ -; stub file diff --git a/cebpic/morse-defs.inc b/cebpic/morse-defs.inc deleted file mode 100644 index 420d28f..0000000 --- a/cebpic/morse-defs.inc +++ /dev/null @@ -1 +0,0 @@ - include common.inc diff --git a/cebpic/morse-auto.asm-gen b/cebpic/morse-generator similarity index 83% rename from cebpic/morse-auto.asm-gen rename to cebpic/morse-generator index e30b21e..ebf0830 100755 --- a/cebpic/morse-auto.asm-gen +++ b/cebpic/morse-generator @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Converts morse-auto.messages to morse-auto.asm or morse-auto.inc. -# morse.asm specifies some flash contents, as follows: +# Converts morse.messages to *+morse.asm or morse+auto.inc. +# morse-auto.asm specifies some flash contents, as follows: # # Each message XY produces a symbol # morse_XY @@ -28,19 +28,25 @@ # should also arrange to define any symbolic addresse referred to # in morse-auto.messages, eg by including the pXXXX.inc. # -# morse-auto.asm contains the actual source and morse-auto.inc -# contains `extern' references for the labels morse_XY. +# *+morse.asm contains the actual source and morse+auto.inc +# contains `equ' definitions for the addresses morse_XY. use IO::File; use IO::Handle; sub badusage () { die ("usages:\n". - " morse-auto.asm-gen ... asm\n". - " morse-auto.asm-gen ... [.map] inc\n"); + " morse-generator ... asm\n". + " morse-generator ... [.map] inc\n"); } @ARGV or badusage(); + +$includefile= 'morse-defs.inc'; +if ($ARGV[$#ARGV] =~ s/^\-I//) { + $includefile= pop @ARGV; +} + $which= pop @ARGV; $which eq 'asm' or $which eq 'inc' or badusage(); @@ -52,7 +58,7 @@ while () { $morse{$let}= $morse; } -sub oops ($) { die "morse-auto.asm-gen: $ARGV:$.: $_[0]\n"; } +sub oops ($) { die "morse-generator: $ARGV:$.: $_[0]\n"; } $mapfile= $ARGV[$#ARGV]; @@ -70,7 +76,7 @@ if ($mapfile =~ m/\.map$/) { ($sym,$val,$progdata,$staticext,$filename) = ($1,$2,$3,$4,$5); next if $progdata ne 'data'; $filename =~ s/\.asm$//; - $sym= "$filename:$sym" if $staticext eq 'static'; + $sym= $staticext eq 'static' ? "$filename:$sym" : "::$sym"; $symval{$sym}= $val; } die "$0: $mapfile: $!\n" if $maph->error; @@ -83,14 +89,14 @@ print <<'END' or die $! END ; -print <<'END' or die $! - - include morse-defs.inc - include morse-auto.inc +print <) { unshift @data, sprintf "0x%x%x", scalar(@addrs), $morse_bytes; push @data, map { s/^\:/ $filename.':' /e; - $filename= $1 if m/^(.+)\:/; - (exists $symval{$_} ? $symval{$_} : - "$_ - (0xf00 * !(($_ & 0xf00)^0xf00))"); - + $filename= $1 if m/^([^:]+)\:/; + $_ = $symval{$_} if exists $symval{$_}; + m/\:/ ? ' xxx_unknown_xxx' : "$_ - (0xf00 * !(($_ & 0xf00)^0xf00))" } @addrs; push @data, ('0') x (3 - (scalar(@data) + 3) % 4); diff --git a/cebpic/morse-auto.messages b/cebpic/morse.messages similarity index 100% rename from cebpic/morse-auto.messages rename to cebpic/morse.messages diff --git a/detpic/.cvsignore b/detpic/.cvsignore index 349455e..043209e 100644 --- a/detpic/.cvsignore +++ b/detpic/.cvsignore @@ -1,10 +1,11 @@ -*.hex +*+morse.asm *.cod +*.hex *.lst *.map -*-automorse.asm -idlocs*.asm +.submakefile +blank[0246].asm gpsim.log -morse-auto.asm -morse-auto.inc +idlocs*.asm +morse+auto.inc ours-pindata.asm diff --git a/detpic/Makefile b/detpic/Makefile index a0bf895..04d3e90 100644 --- a/detpic/Makefile +++ b/detpic/Makefile @@ -1,12 +1,19 @@ -PROGRAMS= test-sofar -INCLUDES= common.inc final.inc morse-auto.inc \ - ../iwjpictest/insn-aliases.inc -LIBS= vectors.o panic.o routines-led.o variables.o i2clib.o -DEFLIBS= test-sofar-automorse.o -PICNOS= 0 1 2 + CEBPIC= ../cebpic/ -TARGETS= $(addsuffix -bare.map, $(PROGRAMS)) \ - $(foreach i, $(PICNOS), perpic$i.hex) +PICNOS= 0 1 2 + +PROGRAMS= test-sofar +OBJS_test-sofar= vectors.o panic.o routines-led.o i2clib.o +XCODEN_test-sofar= morse +XCODE1_test-sofar= blank2 blank6 + +INCLUDES= common.inc \ + final.inc \ + i2clib.inc \ + panic.fin \ + panic.inc \ + routines-led.fin \ + vectors.fin include $(CEBPIC)manypics.make diff --git a/detpic/common.inc b/detpic/common.inc index 9f22958..f6388f8 100644 --- a/detpic/common.inc +++ b/detpic/common.inc @@ -1,15 +1,13 @@ ; common macros & equs etc. ;********************************************************************** -; boilerplate.inc -; Include this at the top of each file. -; Does the following things: -; includes the PIC18F458 definitions file (register and bit names) -; switches to decimal by default +; common.inc +; Generally include this at the top of each file. include /usr/share/gputils/header/p18f458.inc radix dec include panic.inc + include morse+auto.inc include ../iwjpictest/insn-aliases.inc ;**************************************************************************** diff --git a/detpic/i2clib.asm b/detpic/i2clib.asm index d90803f..f0a2565 100644 --- a/detpic/i2clib.asm +++ b/detpic/i2clib.asm @@ -7,6 +7,7 @@ radix dec include ../iwjpictest/insn-aliases.inc include panic.inc + include morse+auto.inc ;====================================================================== ; NOTATION diff --git a/detpic/morse-auto.fin b/detpic/morse-auto.fin deleted file mode 100644 index d15603a..0000000 --- a/detpic/morse-auto.fin +++ /dev/null @@ -1 +0,0 @@ - include final.inc diff --git a/detpic/morse-defs.inc b/detpic/morse-defs.inc deleted file mode 100644 index 00a54bd..0000000 --- a/detpic/morse-defs.inc +++ /dev/null @@ -1 +0,0 @@ - include common.inc diff --git a/detpic/morse-auto.messages b/detpic/morse.messages similarity index 97% rename from detpic/morse-auto.messages rename to detpic/morse.messages index 6b5b820..54847f6 100644 --- a/detpic/morse-auto.messages +++ b/detpic/morse.messages @@ -30,6 +30,8 @@ TI4 ; for iwj TI5 ; for iwj X test-sofar:ch ; bad character received from host +Z ::nonexistent_variable ; test message + # Messages for i2clib, S* SM i2clib:st,:sspstat,:sspcon1,:sspcon2 ; m.,i., ctrlr bad state SS i2clib:st,:sspstat,:sspcon1 ; slave, intr, controller bad state diff --git a/detpic/panic.inc b/detpic/panic.inc index 1cff68a..82920d6 100644 --- a/detpic/panic.inc +++ b/detpic/panic.inc @@ -11,5 +11,3 @@ panic macro message ; Area filled in by morse-auto.asm (see morse-auto.asm-gen for details) morse_messages_start equ 0x4000 morse_messages_end equ 0x4400 - - include morse-auto.inc diff --git a/detpic/seriallib.inc b/detpic/seriallib.inc deleted file mode 100644 index 98af2e6..0000000 --- a/detpic/seriallib.inc +++ /dev/null @@ -1,211 +0,0 @@ -;###################################################################### -; seriallib.inc - SERIAL LIBRARY - DECLARATIONS AND DOCUMENTATION -; -;============================================================ -; GENERAL INFORMATION - -; Purpose: -; -------- -; -; This library allows the PIC to communicate with the host via the -; PIC's UART, configured for RS232 at 9600 8N1. It implements -; unidirectional flow control: the host may ask the PIC not to -; transmit, but not vice versa. - -; Naming scheme: -; -------------- -; -; serial_... are for use by the rest of the program and -; are the entrypoints which enable use of the serial port -; serialu_... must be defined in the rest of the program -; with the functionality and behaviour described. - -; At all times following serial_init, the serial hardware in the PIC is -; completely reserved to the routines defined in seriallib.asm. Nothing -; else is allowed to read or modify the PIC UART state. - -; Use of PORTB, RBIF etc.: -; ------------------------ -; -; The seriallib makes use of the PORTB `interrupt on change' feature, -; and expects at all times after serial_init to have exclusive use of -; that feature, including the RBIF flag. Only seriallib is allowed to -; make reads of PORTB directly; the main program must call -; serial_portb_read instead. The main program may freely write to -; LATB. -; -; If any of RB5, RB6 or RB7 is an output which would be electrically -; floating if left in tristate (Z state) by the PIC then before -; calling serial_init the main program must have configured the -; appropriate TRISB bit(s) as outputs - presumably, after having -; configured the corresponding LATB bit(s). This will avoid excessive -; interrupts resulting from floating values. -; -; Registers and calling conventions: -; ---------------------------------- -; -; Unless otherwise stated, all routines accept any value in, and may -; trash, W and the flags. All other registers and locations not -; specifically mentioned here will be preserved by the -; serial_... routines (and are therefore reserved for the rest of the -; program). In all cases, routines are called with CALL or RCALL or -; the equivalent, and routines are allowed to have subroutines (ie, to -; use the call/return address stack). - -; serial_... routines except serial_interrupt will never _directly_ call -; any serialu_... routine; when we say `causes' this means that the -; relevant serialu_... routine will be called at some later point from -; serial_interrupt. serialu_... routines are allowed to call appropriate -; serial_... routines (except serial_interrupt) directly if the context -; and Tx State allows. - -; All routines except serial_init and serial_write_please -; must be called only: -; * During a low-priority interrupt; -; * From the main loop with low-priority interrupts disabled; or -; * From within an serialu_... routine (which are always called -; from within serial_interrupt). -; This is to avoid having one serial_... routine running in an interrupt -; which interrupted the middle of another serial_... routine. - -; Some time between calling serial_init and waiting for the first event, -; the main program should of course enable interrupts. - -;============================================================ -; COMMON ROUTINES and RECEPTION - -;-------------------- - extern serial_init -; -; Initialises the serial port and library state appropriately. Must -; be called exactly once, which must be before any other -; serial_... function. -; -; At call On return -; serial controller any for use by seriallib -; PORTB any for use by seriallib -; serial interrupt config any enabled, low priority -; Port B interrupt-on-change any enabled, low priority -; TRISB<5:7> any outputs configured unchanged -; TRISB<4> any configured for input -; TRISB<0:2> any unchanged -; LATB any outputs configured unchanged, use freely -; global interrupt enable disabled unchanged -; Tx State Not-in-use Must-Notify -; -; Note that as soon as the interrupts are enabled, the serial port -; will generate an interrupt, so that we go from Tx State Must-Notify -; to Idle via call to serialu_writeable. (See the Transmission -; section below.) - -;-------------------- - extern serial_portb_read -; At call On return -; W any value from PORTB -; -; Provided to allow the main program to read any bits in PORTB which -; it is using as inputs. See the notes above about PORTB. - -;-------------------- - extern serial_interrupt -; -; Must be called by the main program's low priority interrupt handler. -; The main program's interrupt handler is responsible for saving W and -; the flags register and other interrupt-related administrivia. If -; there is a serial interrupt, this routine will service it, taking any -; necessary action including calling appropriate serialu_... routines, -; and clear the interrupt flag[*]. -; -; At call On return -; Tx State any except Not-in-use may change -; serial interrupt state any cleared[*] -; -; [*] The interrupt event on entry, if any, will be dealt with. If -; interrupt processing takes a long time, another interrupt will occur -; and this may result in the serial interrupt flag being set on return -; from serial_inerrupt. - -;-------------------- - extern serialu_receive -; -; Called to notify the main program that a byte has been recieved from -; the host. The byte value is supplied. There is no way for the PIC -; to signal flow control to the host, to stop the host from sending -; data. It is up to the main program to do _something_ with the -; received data (or to panic or to discard it). -; -; Beforehand At call -; W data byte from host - -;====================================================================== -; TRANSMISSION -; -; States: -; [Not-in-use] -; | -; |init -; V -; ,------------->+<-------------. -; | | | -; | [Must-Notify] | -; | | | -; | write_ready| | -; | | | -; | V | -; | [Idle] | -; | | `-----------' -; | write_byte| write_please -; | | -; | V -; | [Busy]<----------. -; | | `-----------' -; `--------------' write_please - -; The seriallib will handle the host's requests for flow control. - -;-------------------- - extern serialu_write_ready -; -; Called to notify the main program that the serial port is now ready -; to transmit a byte. The main program should call serial_write_byte, -; or serial_write_please, either immediately or at some later point. -; -; Beforehand At call -; Tx State Must-Notify Idle - -;-------------------- - extern serial_write_byte -; -; Provides a byte to be written to the serial port. -; -; At call On return -; Tx State Idle Busy -; W byte for host any - -;-------------------- - extern serial_write_please -; -; Asks to be re-notified if the serial port is ready for transmission. -; This will regenerate the call to serialu_write_ready if applicable. -; -; At call On return -; Tx State Idle Must-Notify -; Tx State Busy Busy -; -; serialu_write_ready will *not* be called directly from -; serial_write_please, but only from serial_interrupt (as discussed -; above). -; -; Exceptionally, serial_write_please is fully reentrant. It need not -; be called from interrupt context and need not be called with -; interrupts disabled. It is permissible for serial_write_please to -; be interrupted by an invocation of serial_interrupt or vice versa. -; -; Use example: if the main program has a buffer of characters for -; transmission, serialu_write_ready would call serial_write_byte if -; the buffer had something in it. If it didn't then it would simply -; return. When something is put in the buffer, the main program would -; call serial_write_please unconditionally, which would ensure that -; serialu_write_ready will be called soon. - -;====================================================================== diff --git a/detpic/test-sofar.asm b/detpic/test-sofar.asm index 220f167..b63dd7f 100644 --- a/detpic/test-sofar.asm +++ b/detpic/test-sofar.asm @@ -67,11 +67,6 @@ include common.inc -garbage2 code 0x2000 - db 1 -garbage6 code 0x6000 - db 1 - udata_acs t res 1 diff --git a/detpic/variables.asm b/detpic/variables.asm deleted file mode 100644 index 03a4105..0000000 --- a/detpic/variables.asm +++ /dev/null @@ -1,9 +0,0 @@ -; reservations for variables - -; boilerplate: - - include /usr/share/gputils/header/p18f458.inc - radix dec - - - end diff --git a/hostside/Makefile b/hostside/Makefile index 7ad2d7d..67f7942 100644 --- a/hostside/Makefile +++ b/hostside/Makefile @@ -7,6 +7,8 @@ include ../cprogs.make TARGETS= hostside hostside-old gui-plan-bot +default: all +recurse: all all: $(TARGETS) hostside-old: serialio.o nmra.o main.o encode.o utils.o diff --git a/iwjpictest/Makefile b/iwjpictest/Makefile index 696a170..02dacca 100644 --- a/iwjpictest/Makefile +++ b/iwjpictest/Makefile @@ -9,8 +9,20 @@ PROGRAMS= flasher copybits serialloop harness INCLUDES= insn-aliases.inc onecopybit.inc test.inc include ../common.make + +PROGRAM_HEXES= $(addsuffix .hex, $(PROGRAMS)) \ + $(addsuffix -withcfg.hex, $(PROGRAMS)) + +all: $(TARGETS) $(PROGRAM_HEXES) + include ../pic.make +%-withcfg.hex: %.o config.o $(LIBS) $(DEFLIBS) + $(LINK) + +%.hex: %.o $(LIBS) $(DEFLIBS) + $(LINK) + clean: pic-clean rm -f $(INSN_TARGETS) diff --git a/layout/Makefile b/layout/Makefile index 025b630..777d438 100644 --- a/layout/Makefile +++ b/layout/Makefile @@ -22,6 +22,8 @@ LPAGES= $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps)) CPROGS= subseg2display compose-segenco default: $(CPROGS) for-test-ui +for-pic: ours-pindata.asm +recurse: $(CPROGS) for-pic all: default lpages layers extras for-test-ui: ours.graph.c ours.redactgraph ours.raw.neato.ps \ ours.redacted.neato.ps ours.layout-data.o \ @@ -35,8 +37,10 @@ extras: dualjn-a.ps parts.ps include ours.dgram.m include segencolayers.m -NETPBM= -lnetpbm -# -lppm +NETPBM = -lnetpbm +ifeq (,$(shell test -f /usr/lib/libppm.so || echo no)) +NETPBM += -lppm +endif REDACT= consistency movfeatsplitedges \ consistency movfeatrmstubs \ diff --git a/pic.make b/pic.make index 478181c..45009c6 100644 --- a/pic.make +++ b/pic.make @@ -14,19 +14,9 @@ # FOO-entire0.hex FOO.o idlocs0.o config.o # perpicNUMBER.hex idlocsNUMBER.o config.o -PROGRAM_HEXES= $(addsuffix .hex, $(PROGRAMS)) \ - $(addsuffix -withcfg.hex, $(PROGRAMS)) - -all: $(TARGETS) $(PROGRAM_HEXES) LINK= gplink -m -o $@ $^ ASSEMBLE= gpasm -p 18f458 -%-withcfg.hex: %.o config.o $(LIBS) $(DEFLIBS) - $(LINK) - -%.hex: %.o $(LIBS) $(DEFLIBS) - $(LINK) - %.o: %.asm $(INCLUDES) $(ASSEMBLE) -c $< mv $*.lst $*-asm.lst @@ -35,4 +25,4 @@ ASSEMBLE= gpasm -p 18f458 pic-clean: -rm -f -- *~ *.new *.tmp - -rm -f *.hex *.cod *.lst *.o + -rm -f *.hex *.cod *.lst *.o *.map